This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/18934] New: Spurious Uninitialized Variable Warning
- From: "llewins at raytheon dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 Dec 2004 23:12:15 -0000
- Subject: [Bug c++/18934] New: Spurious Uninitialized Variable Warning
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
// Spurious Uninitialized Variable Warning (gcc 3.4.3)
// Lloyd Lewins
// Raytheon Co
// llewins@raytheon.com
//
// Using gcc 3.4.3, the following spurious warning regarding rFileName is
generated:
/*
> g++-343 -v -c -Wno-deprecated -Wall -O2 test1.cc
Reading specs from /usr/local/lib/gcc/i686-pc-cygwin/3.4.3/specs
Configured with: /usr/local/src/gcc-3.4.3/configure --prefix=/usr/local --progra
m-suffix=-343 --enable-languages=c,c++ --with-gcc --with-gnu-ld --with-gnu-as --
enable-threads=posix --enable-nls --enable-shared
Thread model: posix
gcc version 3.4.3
/usr/local/libexec/gcc/i686-pc-cygwin/3.4.3/cc1plus.exe -quiet -v -D__CYGWIN32_
_ -D__CYGWIN__ -Dunix -D__unix__ -D__unix -idirafter /usr/lib/../include/w32api
-idirafter /usr/local/lib/gcc/i686-pc-cygwin/3.4.3/../../../../../include/w32api
test1.cc -quiet -dumpbase test1.cc -mtune=pentiumpro -auxbase test1 -O2 -Wno-de
precated -Wall -version -o /tmp/ccJ5ooP1.s
ignoring nonexistent directory "/usr/local/lib/gcc/i686-pc-cygwin/3.4.3/../../..
/../i686-pc-cygwin/include"
ignoring duplicate directory "/usr/local/lib/gcc/i686-pc-cygwin/3.4.3/../../../.
./../include/w32api"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/lib/gcc/i686-pc-cygwin/3.4.3/../../../../include/c++/3.4.3
/usr/local/lib/gcc/i686-pc-cygwin/3.4.3/../../../../include/c++/3.4.3/i686-pc-c
ygwin
/usr/local/lib/gcc/i686-pc-cygwin/3.4.3/../../../../include/c++/3.4.3/backward
/usr/local/include
/usr/local/lib/gcc/i686-pc-cygwin/3.4.3/include
/usr/include
/usr/lib/../include/w32api
End of search list.
GNU C++ version 3.4.3 (i686-pc-cygwin)
compiled by GNU C version 3.4.3.
GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=130998
test1.cc: In function `int main()':
test1.cc:56: warning: unused variable 'c'
test1.cc:59: warning: 'rFileName' might be used uninitialized in this function
as -o test1.o /tmp/ccJ5ooP1.s
*/
// Since rFileName is initialized at definition, it is hard to see how it is
ever
// uninitialized!!
extern void foo();
extern void bar(char* );
extern char* foobar();
class C {public: ~C() {foo();}};
int main()
{
C c;
// Try to open the reserve file -- check for error
char* rFileName = foobar();
// Read the reserve file -- catch exceptions
try {
foo();
}
catch (...) {
bar(rFileName);
}
foo();
}
--
Summary: Spurious Uninitialized Variable Warning
Product: gcc
Version: 3.4.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: llewins at raytheon dot com
CC: gcc-bugs at gcc dot gnu dot org,llewins at raytheon dot
com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18934