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; 8+ 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] 8+ messages in thread

* [Bug c/30949] "incompatible pointer type" warning does not point to declaration
  2007-02-24 18:48 [Bug c/30949] New: "incompatible pointer type" warning does not point to declaration schnetter at aei dot mpg dot de
@ 2008-02-14  2:16 ` manu at gcc dot gnu dot org
  2008-08-28 19:37 ` manu at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-02-14  2:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from manu at gcc dot gnu dot org  2008-02-14 02:15 -------
I have a patch for this but it is not suitable for stage3, so it'll have to
wait until 4.4.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |manu at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-02-14 02:15:51
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30949


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

* [Bug c/30949] "incompatible pointer type" warning does not point to declaration
  2007-02-24 18:48 [Bug c/30949] New: "incompatible pointer type" warning does not point to declaration 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
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-08-28 19:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from manu at gcc dot gnu dot org  2008-08-28 19:35 -------
Subject: Bug 30949

Author: manu
Date: Thu Aug 28 19:34:36 2008
New Revision: 139729

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=139729
Log:
2008-08-28  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

        PR c/30949
        * c-typeck.c (convert_for_assignment): Give a note describing what
        was passed and what was expected.
testsuite/
        * gcc.dg/pr30949.c: New.
        * gcc.dg/transparent-union-1.c: Update.
        * gcc.dg/cleanup-1.c: Update.
        * gcc.dg/assign-warn-2.c: Update.
        * gcc.dg/conv-2.c: Update.
        * gcc.dg/Wpointer-sign-pedantic.c: Update.
        * gcc.dg/Wpointer-sign-Wall.c: Update.
        * gcc.dg/assign-warn-1.c: Update.
        * gcc.dg/dfp/composite-type.c: Update.
        * gcc.dg/noncompile/20020213-1.c: Update.

Added:
    trunk/gcc/testsuite/gcc.dg/pr30949.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-typeck.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/Wpointer-sign-Wall.c
    trunk/gcc/testsuite/gcc.dg/Wpointer-sign-pedantic.c
    trunk/gcc/testsuite/gcc.dg/assign-warn-1.c
    trunk/gcc/testsuite/gcc.dg/assign-warn-2.c
    trunk/gcc/testsuite/gcc.dg/cleanup-1.c
    trunk/gcc/testsuite/gcc.dg/conv-2.c
    trunk/gcc/testsuite/gcc.dg/dfp/composite-type.c
    trunk/gcc/testsuite/gcc.dg/noncompile/20020213-1.c
    trunk/gcc/testsuite/gcc.dg/transparent-union-1.c


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30949


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

* [Bug c/30949] "incompatible pointer type" warning does not point to declaration
  2007-02-24 18:48 [Bug c/30949] New: "incompatible pointer type" warning does not point to declaration 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
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-08-28 19:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from manu at gcc dot gnu dot org  2008-08-28 19:57 -------
The issue reported is fixed. Thanks for the report.

I am going to include in this bug also the "incompatible types" errors that are
given in the same function, so not marking as fixed yet.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30949


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

* [Bug c/30949] "incompatible pointer type" warning does not point to declaration
  2007-02-24 18:48 [Bug c/30949] New: "incompatible pointer type" warning does not point to declaration schnetter at aei dot mpg dot de
                   ` (2 preceding siblings ...)
  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
  5 siblings, 0 replies; 8+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-10-22 16:36 UTC (permalink / raw)
  To: gcc-bugs

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



------- Comment #4 from manu at gcc dot gnu dot org  2008-10-22 16:34 -------
Subject: Bug 30949

Author: manu
Date: Wed Oct 22 16:33:17 2008
New Revision: 141298

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141298
Log:
2008-10-22  Manuel López-Ibáñez  <manu@gcc.gnu.org>

        PR c/30949
        * c-typeck.c (convert_for_assignment): Do not give declaration's
        location for builtins. Spell out which type was expected and which
        was given.
testsuite/
        * gcc.target/i386/sse-vect-types.c: Update.
        * gcc.dg/simd-5.c: Update.
        * gcc.dg/assign-warn-2.c: Update.
        * gcc.dg/simd-2.c: Update.
        * gcc.dg/simd-6.c: Update.
        * gcc.dg/assign-warn-1.c: Update.
        * gcc.dg/dfp/composite-type.c: Update.
        * gcc.dg/simd-1.c: Update.
        * gcc.dg/pr36997.c: Update.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-typeck.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/assign-warn-1.c
    trunk/gcc/testsuite/gcc.dg/assign-warn-2.c
    trunk/gcc/testsuite/gcc.dg/dfp/composite-type.c
    trunk/gcc/testsuite/gcc.dg/pr36997.c
    trunk/gcc/testsuite/gcc.dg/simd-1.c
    trunk/gcc/testsuite/gcc.dg/simd-2.c
    trunk/gcc/testsuite/gcc.dg/simd-5.c
    trunk/gcc/testsuite/gcc.dg/simd-6.c
    trunk/gcc/testsuite/gcc.target/i386/sse-vect-types.c


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30949


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

* [Bug c/30949] "incompatible pointer type" warning does not point to declaration
  2007-02-24 18:48 [Bug c/30949] New: "incompatible pointer type" warning does not point to declaration schnetter at aei dot mpg dot de
                   ` (3 preceding siblings ...)
  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
  5 siblings, 0 replies; 8+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-10-22 16:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from manu at gcc dot gnu dot org  2008-10-22 16:45 -------
This is FIXED in GCC 4.4

Thanks for the report.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30949


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

* [Bug c/30949] "incompatible pointer type" warning does not point to declaration
  2007-02-24 18:48 [Bug c/30949] New: "incompatible pointer type" warning does not point to declaration schnetter at aei dot mpg dot de
                   ` (4 preceding siblings ...)
  2008-10-22 16:47 ` manu at gcc dot gnu dot org
@ 2009-06-05 17:33 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-06-05 17:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2009-06-05 17:32 -------
*** Bug 40356 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |naesten at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30949


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

* [Bug c/30949] "incompatible pointer type" warning does not point to declaration
       [not found] <bug-30949-4@http.gcc.gnu.org/bugzilla/>
@ 2021-09-28  8:12 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-28  8:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30949

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pbijdens at storagelabs dot com

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 20422 has been marked as a duplicate of this bug. ***

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

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

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-24 18:48 [Bug c/30949] New: "incompatible pointer type" warning does not point to declaration 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
     [not found] <bug-30949-4@http.gcc.gnu.org/bugzilla/>
2021-09-28  8:12 ` pinskia at gcc dot gnu.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).