public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/37724]  New: "initialization from incompatible pointer type" does not say which field is being initialized
@ 2008-10-03  5:27 pinskia at gcc dot gnu dot org
  2008-10-03  5:40 ` [Bug c/37724] " pinskia at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-10-03  5:27 UTC (permalink / raw)
  To: gcc-bugs

When I was upgrading the PS3 toolchain I found it would have been useful to
figure out which field of a struct was being initialized with this warning
turned on.
Take:
struct f
{
  int *a;
};

char b[10];
struct f g = {b};

--- CUT ---
Currently we just get:
t.c:7: warning: initialization from incompatible pointer type

But with a large macro like what is in GCC sources, it is hard to figure out
which field has the incompatible pointer type.
Likewise for the diffs in signedness warning.


-- 
           Summary: "initialization from incompatible pointer type" does not
                    say which field is being initialized
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org


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


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

* [Bug c/37724] "initialization from incompatible pointer type" does not say which field is being initialized
  2008-10-03  5:27 [Bug c/37724] New: "initialization from incompatible pointer type" does not say which field is being initialized pinskia at gcc dot gnu dot org
@ 2008-10-03  5:40 ` pinskia at gcc dot gnu dot org
  2008-10-03 12:52 ` rguenth at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-10-03  5:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2008-10-03 05:39 -------
I wonder why error_init/pedwarn_init/warning_init are not used in
WARN_FOR_ASSIGNMENT.

This would fix the issue ...


-- 


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


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

* [Bug c/37724] "initialization from incompatible pointer type" does not say which field is being initialized
  2008-10-03  5:27 [Bug c/37724] New: "initialization from incompatible pointer type" does not say which field is being initialized pinskia at gcc dot gnu dot org
  2008-10-03  5:40 ` [Bug c/37724] " pinskia at gcc dot gnu dot org
@ 2008-10-03 12:52 ` rguenth at gcc dot gnu dot org
  2008-10-03 17:35 ` pinskia at gmail dot com
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-10-03 12:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2008-10-03 12:51 -------
patches welcome ;))  Indeed, this would be nice to fix.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


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


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

* [Bug c/37724] "initialization from incompatible pointer type" does not say which field is being initialized
  2008-10-03  5:27 [Bug c/37724] New: "initialization from incompatible pointer type" does not say which field is being initialized pinskia at gcc dot gnu dot org
  2008-10-03  5:40 ` [Bug c/37724] " pinskia at gcc dot gnu dot org
  2008-10-03 12:52 ` rguenth at gcc dot gnu dot org
@ 2008-10-03 17:35 ` pinskia at gmail dot com
  2008-10-03 20:43 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gmail dot com @ 2008-10-03 17:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gmail dot com  2008-10-03 17:33 -------
Subject: Re:  "initialization from incompatible pointer type" does not say
which field is being initialized



Sent from my iPhone

On Oct 3, 2008, at 5:51 AM, "rguenth at gcc dot gnu dot org"
<gcc-bugzilla@gcc.gnu.org 
 > wrote:

>
>
> ------- Comment #2 from rguenth at gcc dot gnu dot org  2008-10-03  
> 12:51 -------
> patches welcome ;))  Indeed, this would be nice to fix.

I will be testing the patch today. :).

>
>
>
> -- 
>
> rguenth at gcc dot gnu dot org changed:
>
>           What    |Removed                     |Added
> --- 
> --- 
> ----------------------------------------------------------------------
>           Severity|normal                      |enhancement
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37724
>
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.


-- 


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


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

* [Bug c/37724] "initialization from incompatible pointer type" does not say which field is being initialized
  2008-10-03  5:27 [Bug c/37724] New: "initialization from incompatible pointer type" does not say which field is being initialized pinskia at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2008-10-03 17:35 ` pinskia at gmail dot com
@ 2008-10-03 20:43 ` pinskia at gcc dot gnu dot org
  2009-04-22 20:59 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-10-03 20:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2008-10-03 20:41 -------
I have a patch which I am testing right now:
Index: c-typeck.c
===================================================================
--- c-typeck.c  (revision 140850)
+++ c-typeck.c  (working copy)
@@ -3994,7 +3994,7 @@ convert_for_assignment (tree type, tree 
         pedwarn (LOCATION, OPT, AS);                                     \
         break;                                                           \
       case ic_init:                                                      \
-        pedwarn (LOCATION, OPT, IN);                                     \
+        pedwarn_init (LOCATION, OPT, IN);                                \
         break;                                                           \
       case ic_return:                                                    \
         pedwarn (LOCATION, OPT, RE);                                     \

--- CUT ---
This does not fix C++ though, that is going to be harder.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pinskia at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-10-03 20:41:52
               date|                            |


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


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

* [Bug c/37724] "initialization from incompatible pointer type" does not say which field is being initialized
  2008-10-03  5:27 [Bug c/37724] New: "initialization from incompatible pointer type" does not say which field is being initialized pinskia at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2008-10-03 20:43 ` pinskia at gcc dot gnu dot org
@ 2009-04-22 20:59 ` pinskia at gcc dot gnu dot org
  2010-04-09  2:19 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-04-22 20:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2009-04-22 20:58 -------
With the patch we have issues with %< and %> not being converted to quotes, I
am going to unassign myself for now.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|pinskia at gcc dot gnu dot  |unassigned at gcc dot gnu
                   |org                         |dot org
             Status|ASSIGNED                    |NEW


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


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

* [Bug c/37724] "initialization from incompatible pointer type" does not say which field is being initialized
  2008-10-03  5:27 [Bug c/37724] New: "initialization from incompatible pointer type" does not say which field is being initialized pinskia at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2009-04-22 20:59 ` pinskia at gcc dot gnu dot org
@ 2010-04-09  2:19 ` pinskia at gcc dot gnu dot org
  2010-05-28 17:15 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-04-09  2:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2010-04-09 02:19 -------
*** Bug 43664 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jengelh at medozas dot de


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


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

* [Bug c/37724] "initialization from incompatible pointer type" does not say which field is being initialized
  2008-10-03  5:27 [Bug c/37724] New: "initialization from incompatible pointer type" does not say which field is being initialized pinskia at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2010-04-09  2:19 ` pinskia at gcc dot gnu dot org
@ 2010-05-28 17:15 ` pinskia at gcc dot gnu dot org
  2010-06-08  3:57 ` pzhao at gcc dot gnu dot org
  2010-06-08  4:02 ` pzhao at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-05-28 17:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pinskia at gcc dot gnu dot org  2010-05-28 17:15 -------
*** Bug 44316 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |herron dot philip at
                   |                            |googlemail dot com


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


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

* [Bug c/37724] "initialization from incompatible pointer type" does not say which field is being initialized
  2008-10-03  5:27 [Bug c/37724] New: "initialization from incompatible pointer type" does not say which field is being initialized pinskia at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2010-05-28 17:15 ` pinskia at gcc dot gnu dot org
@ 2010-06-08  3:57 ` pzhao at gcc dot gnu dot org
  2010-06-08  4:02 ` pzhao at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pzhao at gcc dot gnu dot org @ 2010-06-08  3:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pzhao at gcc dot gnu dot org  2010-06-08 03:56 -------
Subject: Bug 37724

Author: pzhao
Date: Tue Jun  8 03:56:40 2010
New Revision: 160418

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=160418
Log:
gcc/
2010-06-08  Andrew Pinski <pinskia@gmail.com>
            Shujing Zhao  <pearly.zhao@oracle.com>

        PR c/37724
        * c-typeck.c (convert_for_assignment): Call pedwarn_init if the
        implicit bad conversions is initialization.
        (error_init): Use gmsgid instead of msgid for argument name and change
        the call for error.
        (pedwarn_init): Use gmsgid instead of msgid for argument name and
        change the call for pedwarn.
        (warning_init): Use gmsgid instead of msgid for argument name and
        change the call for warning.

gcc/testsuite/
2010-06-08  Andrew Pinski <pinskia@gmail.com>
            Shujing Zhao  <pearly.zhao@oracle.com>

        PR c/37724
        * gcc.dg/c90-const-expr-10.c: Adjust.
        * gcc.dg/c99-const-expr-10.c: Adjust.
        * gcc.dg/init-bad-7.c: New.


Added:
    trunk/gcc/testsuite/gcc.dg/init-bad-7.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-typeck.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/c90-const-expr-10.c
    trunk/gcc/testsuite/gcc.dg/c99-const-expr-10.c


-- 


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


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

* [Bug c/37724] "initialization from incompatible pointer type" does not say which field is being initialized
  2008-10-03  5:27 [Bug c/37724] New: "initialization from incompatible pointer type" does not say which field is being initialized pinskia at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2010-06-08  3:57 ` pzhao at gcc dot gnu dot org
@ 2010-06-08  4:02 ` pzhao at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pzhao at gcc dot gnu dot org @ 2010-06-08  4:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from pzhao at gcc dot gnu dot org  2010-06-08 04:02 -------
Fixed for trunk.


-- 

pzhao at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2010-06-08  4:02 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-03  5:27 [Bug c/37724] New: "initialization from incompatible pointer type" does not say which field is being initialized pinskia at gcc dot gnu dot org
2008-10-03  5:40 ` [Bug c/37724] " pinskia at gcc dot gnu dot org
2008-10-03 12:52 ` rguenth at gcc dot gnu dot org
2008-10-03 17:35 ` pinskia at gmail dot com
2008-10-03 20:43 ` pinskia at gcc dot gnu dot org
2009-04-22 20:59 ` pinskia at gcc dot gnu dot org
2010-04-09  2:19 ` pinskia at gcc dot gnu dot org
2010-05-28 17:15 ` pinskia at gcc dot gnu dot org
2010-06-08  3:57 ` pzhao at gcc dot gnu dot org
2010-06-08  4:02 ` pzhao 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).