This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/30949] New: "incompatible pointer type" warning does not point to declaration
- From: "schnetter at aei dot mpg dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Feb 2007 18:48:33 -0000
- Subject: [Bug c/30949] New: "incompatible pointer type" warning does not point to declaration
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
I passed a pointer of the wrong type to a function. I received a warning about
this. This warning contained only little information; it only said that the
pointer types differ. It did not specify what type was passed, nor what type
was expected, nor where the declaration of the called function is.
A test programme is
int func (int x);
void recv (int (* funcptr) (double x));
void call (void)
{
recv (func);
}
This programme calls "recv" with a wrong argument. When I compile this, I
receive the warning below:
$ ~/gcc/bin/gcc --version
gcc (GCC) 4.3.0 20070201 (experimental)
$ ~/gcc/bin/gcc -Wall -c fptr.c
fptr.c: In function ?call?:
fptr.c:7: warning: passing argument 1 of ?recv? from incompatible pointer type
I would have liked a multi-line warning, pointing to the line which declares
"recv". I also would have liked an explanation like "the passed argument is of
type int (*)(int), but the type int (*)(double) is expected".
--
Summary: "incompatible pointer type" warning does not point to
declaration
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: schnetter at aei dot mpg dot de
GCC build triplet: i386-apple-darwin8.8.1
GCC host triplet: i386-apple-darwin8.8.1
GCC target triplet: i386-apple-darwin8.8.1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30949