public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "schnetter at aei dot mpg dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/30949]  New: "incompatible pointer type" warning does not point to declaration
Date: Sat, 24 Feb 2007 18:48:00 -0000	[thread overview]
Message-ID: <bug-30949-7427@http.gcc.gnu.org/bugzilla/> (raw)

[-- 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


             reply	other threads:[~2007-02-24 18:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-24 18:48 schnetter at aei dot mpg dot de [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-30949-7427@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).