Static Analysis Problem Type Reference
A subroutine was declared in a way that was inconsistent with its definition.
This error indicates that the return value type of a function, as provided by the declaration in force at a call site, does not match the actual function definition. The declaration may have been implicitly created at the first use of the function. This is a serious error because it can lead the compiler to generate incorrect code that can have unpredictable results.
This same kind of error can also happen when a FORTRAN dummy argument of type subroutine is invoked. That is, the subroutine that is invoked through a dummy argument might exhibit the same problem as can occur in a direct call. In this case, the problem may or may not happen depending on what subroutine was passed to the dummy argument of subroutine type. There will be an additional code location in such cases that identifies the call site where the subroutine argument was passed in.
|
ID |
Code Location |
Description |
|---|---|---|
|
1 |
Call site |
The place where the function was called |
|
2 |
Definition |
The place where the function was defined |
#include <stdio.h>
extern float myFunc(float); // claims myFunc returns float
int main(int argc, char **argv)
{
float a;
a = 3.14;
a = myFunc(a);
printf("%f\n", a);
return 0;
}
file2.c:
#include <stdio.h>
// myFunc actually returns int
int myFunc(float b)
{
printf("%f\n",b);
return 1;
}