public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/36823]  New: Fails to warn about possibly uninitialized variables
@ 2008-07-14 14:03 heide-gcc at bfw-online dot de
  2008-08-11  0:39 ` [Bug c/36823] " pinskia at gcc dot gnu dot org
  2009-02-09 15:35 ` [Bug middle-end/36823] missing uninitialzied warning (IPA, inlining) manu at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: heide-gcc at bfw-online dot de @ 2008-07-14 14:03 UTC (permalink / raw)
  To: gcc-bugs

Target: i686-pc-linux-gnulibc2
Configured with: ../configure --prefix=/tmp/gcc-4.3.1 --disable-nls
--enable-shared --with-sysroot=/usr/i686-pc-linux-gnulibc2/
i686-pc-linux-gnulibc2
gcc version 4.3.1 (GCC)

$ gcc -O -Wall -Wuninitialized -c -o t.o t.c
$ gcc -O -Wall -Wuninitialized -fno-unit-at-a-time -c -o t.o t.c
t.c: In function 'f1':
t.c:14: warning: 'pp' may be used uninitialized in this function
$ cat t.c
struct a
{ struct a *n;
  struct b *b;
};

struct b
{ struct b *n;
};

extern struct a *a;

static int
f1 (struct b *b)
{ struct b *pp;
  struct b *p;
  for (p = b; p; p = p->n) pp = p;
  return (!pp);
}

int
f2 (void)
{ struct a *p;
  for (p = a; p; p = p->n) if (f1 (p->b)) return 0;
  return 1;
}

An older version of gcc (gcc (GCC) 3.3.3) works as expected.
A current version of gcc from Debian Unstable (gcc (Debian 4.3.1-6) 4.3.1)
shows the same failure


-- 
           Summary: Fails to warn about possibly uninitialized variables
           Product: gcc
           Version: 4.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: heide-gcc at bfw-online dot de
 GCC build triplet: i686-pc-linux-gnulibc2
  GCC host triplet: i686-pc-linux-gnulibc2
GCC target triplet: i686-pc-linux-gnulibc2


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


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

* [Bug c/36823] Fails to warn about possibly uninitialized variables
  2008-07-14 14:03 [Bug c/36823] New: Fails to warn about possibly uninitialized variables heide-gcc at bfw-online dot de
@ 2008-08-11  0:39 ` pinskia at gcc dot gnu dot org
  2009-02-09 15:35 ` [Bug middle-end/36823] missing uninitialzied warning (IPA, inlining) manu at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-08-11  0:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2008-08-11 00:37 -------
So what is happening is that we are saying pp is another name for p so it gets
optimized as that.


-- 

pinskia at gcc dot gnu dot org changed:

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


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


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

* [Bug middle-end/36823] missing uninitialzied warning (IPA, inlining)
  2008-07-14 14:03 [Bug c/36823] New: Fails to warn about possibly uninitialized variables heide-gcc at bfw-online dot de
  2008-08-11  0:39 ` [Bug c/36823] " pinskia at gcc dot gnu dot org
@ 2009-02-09 15:35 ` manu at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: manu at gcc dot gnu dot org @ 2009-02-09 15:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from manu at gcc dot gnu dot org  2009-02-09 15:35 -------
After inlining, pp is initialized to 0.

 # BLOCK 3 freq:9550, starting at line 0
  # PRED: 10 [95.5%]  (true,exec)
  [/home/manuel/pr36823.c : 23] D.1611_4 = [/home/manuel/pr36823.c : 23]
pD.1607_2->bD.1592;
  ppD.1620_9 = 0B;
  # SUCC: 4 [100.0%]  (fallthru,exec)

This doesn't seem to be CCP or anything else, but IPA. Something during IPA
just assumes that the undefined value is 0.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-02-09 15:35:38
               date|                            |
            Summary|Fails to warn about possibly|missing uninitialzied
                   |uninitialized variables     |warning (IPA, inlining)


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


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

end of thread, other threads:[~2009-02-09 15:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-14 14:03 [Bug c/36823] New: Fails to warn about possibly uninitialized variables heide-gcc at bfw-online dot de
2008-08-11  0:39 ` [Bug c/36823] " pinskia at gcc dot gnu dot org
2009-02-09 15:35 ` [Bug middle-end/36823] missing uninitialzied warning (IPA, inlining) manu 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).