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 tree-optimization/23563] New: False warning for uninitialized variable: regression from 3.4.2


When I compile warn-thing.cpp (to be attached as soon as I've submitted this
bug) with gcc 4.0.2, I get the warning message

warn-thing.cpp:24: warning: 'variable' may be used uninitialized in this function

This warning appears to me to be incorrect, and did not occur with gcc 3.4.2.

The warning does not occur if optimization is not enabled.

The attached error output is from gcc version 4.0.2 20050728 (prerelease)
[FreeBSD] for i386-portbld-freebsd5.4, but I see the same results with gcc
version 4.0.2 20050806 (prerelease) (Debian 4.0.1-4) for i486-linux-gnu.

$ gcc40 -v -Wall -O2 -c warn-thing.cpp
Using built-in specs.
Target: i386-portbld-freebsd5.4
Configured with: ./..//gcc-4.0-20050728/configure --disable-nls
--with-system-zlib --with-libiconv-prefix=/usr/local --program-suffix=40
--libdir=/usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.2
--with-gxx-include-dir=/usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.2/include/c++/
--with-gmp=/usr/local --disable-shared --prefix=/usr/local i386-portbld-freebsd5.4
Thread model: posix
gcc version 4.0.2 20050728 (prerelease) [FreeBSD]
 /usr/local/libexec/gcc/i386-portbld-freebsd5.4/4.0.2/cc1plus -quiet -v
warn-thing.cpp -quiet -dumpbase warn-thing.cpp -auxbase warn-thing -O2 -Wall
-version -o /var/tmp//ccjEgsIS.s
ignoring nonexistent directory
"/usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.2/gcc/i386-portbld-freebsd5.4/4.0.2/../../../../i386-portbld-freebsd5.4/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.2/include/c++/
 /usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.2/include/c++//i386-portbld-freebsd5.4
 /usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.2/include/c++//backward
 /usr/local/include
 /usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.2/gcc/i386-portbld-freebsd5.4/4.0.2/include
 /usr/include
End of search list.
GNU C++ version 4.0.2 20050728 (prerelease) [FreeBSD] (i386-portbld-freebsd5.4)
        compiled by GNU C version 4.0.2 20050728 (prerelease) [FreeBSD].
GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129460
warn-thing.cpp: In function 'void foo()':
warn-thing.cpp:24: warning: 'variable' may be used uninitialized in this function
 as -o warn-thing.o /var/tmp//ccjEgsIS.s

For comparison, here is the non-warning output of gcc 3.4:

$ gcc -v -Wall -O2 -c warn-thing.cpp
Using built-in specs.
Configured with: FreeBSD/i386 system compiler
Thread model: posix
gcc version 3.4.2 [FreeBSD] 20040728
 /usr/libexec/cc1plus -quiet -v -D_LONGLONG warn-thing.cpp -quiet -dumpbase
warn-thing.cpp -auxbase warn-thing -O2 -Wall -version -o /var/tmp//ccHHC2rw.s
ignoring duplicate directory "/usr/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/3.4
 /usr/include/c++/3.4/backward
 /usr/include
End of search list.
GNU C++ version 3.4.2 [FreeBSD] 20040728 (i386-fbsdproj-freebsd)
        compiled by GNU C version 3.4.2 [FreeBSD] 20040728.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
 /usr/bin/as -v -o warn-thing.o /var/tmp//ccHHC2rw.s
GNU assembler version 2.15 [FreeBSD] 2004-05-23 (i386-obrien-freebsd) using BFD
version 2.15 [FreeBSD] 2004-05-23

-- 
           Summary: False warning for uninitialized variable: regression
                    from 3.4.2
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: lennox at cs dot columbia dot edu
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-portbld-freebsd5.4
  GCC host triplet: i386-portbld-freebsd5.4
GCC target triplet: i386-portbld-freebsd5.4


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


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