This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/50950] New: warning missed when OR'ing to an uninitialized variable


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

             Bug #: 50950
           Summary: warning missed when OR'ing to an uninitialized
                    variable
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: sezeroz@gmail.com


Created attachment 25681
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25681
small test case

$ gcc44 -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc44-svn/configure --enable-checking=yes
--enable-languages=c --enable-shared --enable-threads --with-local-prefix=/usr
--prefix=/opt/gcc440 --program-suffix=44 --bindir=/opt/bin --disable-nls
Thread model: posix
gcc version 4.4.7 20111023 (prerelease) (GCC) 

]$ gcc44 -O2 -Wall -S test.c
test.c: In function 'f1':
test.c:22: warning: 'x' is used uninitialized in this function
test.c: In function 'ff2':
test.c:40: warning: 'y' is used uninitialized in this function
test.c: In function 'ff1':
test.c:30: warning: 'x' is used uninitialized in this function
test.c: In function 'f0':
test.c:14: warning: 'x' is used uninitialized in this function

gcc < 4.4 (tested 3.3.6, 3.4.6 and 4.3.0) and gcc > 4.4 (tested 4.5.4/r180676
and 4.6.1) does not warn at all.  Also notice the selectively issued warnings
in ff1() and ff2(), i.e. only for the first uninitialized variable.

Not sure if this is a duplicate of bug 18501 & co.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]