[Bug c/39113] New: no warning that a variable may be used uninitialized
$gcc -O -Wextra -save-temps um3.c $ um3.c #include main() { char *J; if (rand()) J = NULL; printf("\ntest %s\n",J); } In this example, J could be used uninitialized but the compiler is not giving that warning. -- Summary: no warning that a variable may be used uninitialized Product: gcc Version: 4.3.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dhill at clusterresources dot com GCC build triplet: --build=x86_64-linux-gnu GCC host triplet: --host=x86_64-linux-gnu GCC target triplet: --target=x86_64-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39113
[Bug c/39113] no warning that a variable may be used uninitialized
--- Comment #1 from dhill at clusterresources dot com 2009-02-05 20:51 --- Created an attachment (id=17252) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17252&action=view) .i file -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39113
[Bug c/39113] no warning that a variable may be used uninitialized
--- Comment #2 from dhill at clusterresources dot com 2009-02-05 21:04 --- Here is the gcc -v output if that is helpful $ gcc -v Using built-in specs. Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.3.2-1ubuntu12' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.3.2 (Ubuntu 4.3.2-1ubuntu12) -- dhill at clusterresources dot com changed: What|Removed |Added CC| |dhill at clusterresources | |dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39113
[Bug c/39113] no warning that a variable may be used uninitialized
--- Comment #3 from dhill at clusterresources dot com 2009-02-05 21:48 --- Note that the warning is correctly reported in older versions of the compiler. The following example is from gcc 3.2.3 $ gcc -O -W um3.c um3.c: In function `main': um3.c:5: warning: `J' might be used uninitialized in this function $ gcc -v Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux Thread model: posix gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-59) $ cat um3.c #include main() { char *J; if (rand()) J = NULL; printf("\ntest %s\n",J); } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39113
[Bug tree-optimization/18501] [4.2/4.3/4.4 Regression] Missing 'used uninitialized' warning (CCP)
--- Comment #23 from dhill at clusterresources dot com 2009-02-05 22:44 --- note that gcc version 3.2.3 correctly reports this warning -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18501