public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/30949]  New: "incompatible pointer type" warning does not point to declaration
@ 2007-02-24 18:48 schnetter at aei dot mpg dot de
  2008-02-14  2:16 ` [Bug c/30949] " manu at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: schnetter at aei dot mpg dot de @ 2007-02-24 18:48 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1511 bytes --]

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-09-28  8:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-30949-4@http.gcc.gnu.org/bugzilla/>
2021-09-28  8:12 ` [Bug c/30949] "incompatible pointer type" warning does not point to declaration pinskia at gcc dot gnu.org
2007-02-24 18:48 [Bug c/30949] New: " schnetter at aei dot mpg dot de
2008-02-14  2:16 ` [Bug c/30949] " manu at gcc dot gnu dot org
2008-08-28 19:37 ` manu at gcc dot gnu dot org
2008-08-28 19:58 ` manu at gcc dot gnu dot org
2008-10-22 16:36 ` manu at gcc dot gnu dot org
2008-10-22 16:47 ` manu at gcc dot gnu dot org
2009-06-05 17:33 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).