public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/45085]  New: incorrect -Wuninitialized warning
@ 2010-07-26 16:11 tromey at gcc dot gnu dot org
  2010-07-26 16:13 ` [Bug tree-optimization/45085] " tromey at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: tromey at gcc dot gnu dot org @ 2010-07-26 16:11 UTC (permalink / raw)
  To: gcc-bugs

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

I'm using a relatively recent svn trunk gcc on an x86 Fedora 13 machine.
I'm trying to compile gdb with it.  I got this error:

../../archer/gdb/remote.c: In function ‘remote_wait’:
../../archer/gdb/remote.c:5561:10: error: ‘event_ptid.tid’ may be used
uninitialized in this function [-Werror=uninitialized]
../../archer/gdb/remote.c:5561:10: error: ‘event_ptid.lwp’ may be used
uninitialized in this function [-Werror=uninitialized]
../../archer/gdb/remote.c:5561:10: error: ‘event_ptid.pid’ may be used
uninitialized in this function [-Werror=uninitialized]
cc1: all warnings being treated as errors

But the body of remote_wait is simple:

{
  ptid_t event_ptid;

  if (non_stop)
    event_ptid = remote_wait_ns (ptid, status, options);
  else
    event_ptid = remote_wait_as (ptid, status, options);

  if (target_can_async_p ())
    {
      /* If there are are events left in the queue tell the event loop
         to return here.  */
      if (stop_reply_queue)
        mark_async_event_handler (remote_async_inferior_event_token);
    }

  return event_ptid;
}

I thought perhaps that inlining was causing a problem (in which case this
error message is quite confusing, since it would point to the wrong function).

However, I added this:

  memset (&event_ptid, 0, sizeof (event_ptid));

... to the function before the "if", and the error went away.
So, I think this is a gcc bug.

I will attach the .i file.


-- 
           Summary: incorrect -Wuninitialized warning
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tromey at gcc dot gnu dot org


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


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

* [Bug tree-optimization/45085] incorrect -Wuninitialized warning
  2010-07-26 16:11 [Bug tree-optimization/45085] New: incorrect -Wuninitialized warning tromey at gcc dot gnu dot org
@ 2010-07-26 16:13 ` tromey at gcc dot gnu dot org
  2010-07-27 12:42 ` jakub at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tromey at gcc dot gnu dot org @ 2010-07-26 16:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from tromey at gcc dot gnu dot org  2010-07-26 16:12 -------
Created an attachment (id=21319)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21319&action=view)
compressed .i file


-- 


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


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

* [Bug tree-optimization/45085] incorrect -Wuninitialized warning
  2010-07-26 16:11 [Bug tree-optimization/45085] New: incorrect -Wuninitialized warning tromey at gcc dot gnu dot org
  2010-07-26 16:13 ` [Bug tree-optimization/45085] " tromey at gcc dot gnu dot org
@ 2010-07-27 12:42 ` jakub at gcc dot gnu dot org
  2010-07-27 12:58 ` jakub at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-07-27 12:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jakub at gcc dot gnu dot org  2010-07-27 12:42 -------
Simplified testcase for -m32 -O2 -Wuninitialized:

struct S { char *s1; long s2; };
struct T { int t1; long t2; long t3; };
extern int fn2 (void);
extern int fn3 (struct T);
extern struct T fn4 ();
extern int fn5 (char **, long *, int);
extern void fn6 (void);
extern void fn7 (void *);
struct S *fn10 ();
static int p;
static void *q;
extern struct T r;

static struct T
fn8 (struct T x, int y)
{
  struct S *u = fn10 ();
  int v = fn5 (&u->s1, &u->s2, 0);
  while (1)
    {
      if (p)
fn6 ();
      if (fn3 (x))
return fn4 ();
      if (y & 1)
return r;
      v = fn5 (&u->s1, &u->s2, 1);
    }
}

struct T
fn9 (struct T x, int y)
{
  struct T t = fn8 (x, y);
  if (fn2 ())
    fn7 (q);
  return t;
}

void *
fn1 (void)
{
  return fn9;
}


-- 


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


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

* [Bug tree-optimization/45085] incorrect -Wuninitialized warning
  2010-07-26 16:11 [Bug tree-optimization/45085] New: incorrect -Wuninitialized warning tromey at gcc dot gnu dot org
  2010-07-26 16:13 ` [Bug tree-optimization/45085] " tromey at gcc dot gnu dot org
  2010-07-27 12:42 ` jakub at gcc dot gnu dot org
@ 2010-07-27 12:58 ` jakub at gcc dot gnu dot org
  2010-07-27 13:25 ` [Bug tree-optimization/45085] [4.6 Regression] " jakub at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-07-27 12:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jakub at gcc dot gnu dot org  2010-07-27 12:58 -------
Seems to be caused by partial inlining.
fnsplit splits off the:
  q.0D.2030_3 = qD.1248;
  fn7 (q.0D.2030_3);
part of fn9 into fn9.part.0:
fn9.part.0 ()
{
  intD.0 D.2054;
  voidD.32 * q.0D.2053;
  struct T tD.2052;
  struct T xD.2050;
  intD.0 yD.2051;

<bb 4>:

<bb 2>:
  q.0D.2053_1 = qD.1248;
  fn7 (q.0D.2053_1);

<bb 3>:
  <retval> = tD.2052;
  return <retval>;

}

and uses:
  tD.1261 = fn9.part.0 (); [return slot optimization]
in fn9 instead.  tD.2052 isn't initialized anywhere though (and, it is unclear
why it did that at all, as that hunk doesn't modify t).  Perhaps with -m32 and
aggregate return (where in the end t will be returned via hidden reference) t
is addressable?  In any case, this is fnsplit bug.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu dot
                   |                            |org


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


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

* [Bug tree-optimization/45085] [4.6 Regression] incorrect -Wuninitialized warning
  2010-07-26 16:11 [Bug tree-optimization/45085] New: incorrect -Wuninitialized warning tromey at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2010-07-27 12:58 ` jakub at gcc dot gnu dot org
@ 2010-07-27 13:25 ` jakub at gcc dot gnu dot org
  2010-07-27 14:13 ` hubicka at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-07-27 13:25 UTC (permalink / raw)
  To: gcc-bugs



-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
      Known to fail|                            |4.6.0
      Known to work|                            |4.5.0
   Last reconfirmed|0000-00-00 00:00:00         |2010-07-27 13:25:07
               date|                            |
            Summary|incorrect -Wuninitialized   |[4.6 Regression] incorrect -
                   |warning                     |Wuninitialized warning
   Target Milestone|---                         |4.6.0


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


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

* [Bug tree-optimization/45085] [4.6 Regression] incorrect -Wuninitialized warning
  2010-07-26 16:11 [Bug tree-optimization/45085] New: incorrect -Wuninitialized warning tromey at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2010-07-27 13:25 ` [Bug tree-optimization/45085] [4.6 Regression] " jakub at gcc dot gnu dot org
@ 2010-07-27 14:13 ` hubicka at gcc dot gnu dot org
  2010-08-03 12:09 ` hubicka at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hubicka at gcc dot gnu dot org @ 2010-07-27 14:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from hubicka at gcc dot gnu dot org  2010-07-27 14:13 -------
Hmm, mine :)

Honza


-- 

hubicka at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |hubicka at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2010-07-27 13:25:07         |2010-07-27 14:13:35
               date|                            |


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


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

* [Bug tree-optimization/45085] [4.6 Regression] incorrect -Wuninitialized warning
  2010-07-26 16:11 [Bug tree-optimization/45085] New: incorrect -Wuninitialized warning tromey at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2010-07-27 14:13 ` hubicka at gcc dot gnu dot org
@ 2010-08-03 12:09 ` hubicka at gcc dot gnu dot org
  2010-09-02 11:11 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hubicka at gcc dot gnu dot org @ 2010-08-03 12:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from hubicka at gcc dot gnu dot org  2010-08-03 12:08 -------
Created an attachment (id=21374)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21374&action=view)
patch I am testing.


-- 


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


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

* [Bug tree-optimization/45085] [4.6 Regression] incorrect -Wuninitialized warning
  2010-07-26 16:11 [Bug tree-optimization/45085] New: incorrect -Wuninitialized warning tromey at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2010-08-03 12:09 ` hubicka at gcc dot gnu dot org
@ 2010-09-02 11:11 ` rguenth at gcc dot gnu dot org
  2010-09-02 22:59 ` manu at gcc dot gnu dot org
  2010-09-03  9:11 ` jakub at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-09-02 11:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rguenth at gcc dot gnu dot org  2010-09-02 11:11 -------
This is fixed now?


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |WAITING


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


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

* [Bug tree-optimization/45085] [4.6 Regression] incorrect -Wuninitialized warning
  2010-07-26 16:11 [Bug tree-optimization/45085] New: incorrect -Wuninitialized warning tromey at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2010-09-02 11:11 ` rguenth at gcc dot gnu dot org
@ 2010-09-02 22:59 ` manu at gcc dot gnu dot org
  2010-09-03  9:11 ` jakub at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-09-02 22:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from manu at gcc dot gnu dot org  2010-09-02 22:59 -------
WAITING is for waiting for submitters information. 


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |24639
              nThis|                            |
             Status|WAITING                     |ASSIGNED
           Keywords|                            |patch


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


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

* [Bug tree-optimization/45085] [4.6 Regression] incorrect -Wuninitialized warning
  2010-07-26 16:11 [Bug tree-optimization/45085] New: incorrect -Wuninitialized warning tromey at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2010-09-02 22:59 ` manu at gcc dot gnu dot org
@ 2010-09-03  9:11 ` jakub at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-09-03  9:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jakub at gcc dot gnu dot org  2010-09-03 09:10 -------
Seems http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162842
has been committed, just Honza forgot to mention the PR in the ChangeLog,
testcase and commit message.
I certainly can't reproduce this bug with 20100811 gcc and later, while I can
with 20100730.


-- 

jakub at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2010-09-03  9:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-26 16:11 [Bug tree-optimization/45085] New: incorrect -Wuninitialized warning tromey at gcc dot gnu dot org
2010-07-26 16:13 ` [Bug tree-optimization/45085] " tromey at gcc dot gnu dot org
2010-07-27 12:42 ` jakub at gcc dot gnu dot org
2010-07-27 12:58 ` jakub at gcc dot gnu dot org
2010-07-27 13:25 ` [Bug tree-optimization/45085] [4.6 Regression] " jakub at gcc dot gnu dot org
2010-07-27 14:13 ` hubicka at gcc dot gnu dot org
2010-08-03 12:09 ` hubicka at gcc dot gnu dot org
2010-09-02 11:11 ` rguenth at gcc dot gnu dot org
2010-09-02 22:59 ` manu at gcc dot gnu dot org
2010-09-03  9:11 ` jakub 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).