This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Spurious C++ compiler warning
- To: egcs-bugs at cygnus dot com
- Subject: Spurious C++ compiler warning
- From: Michael Haggerty <mhagger at blizzard dot harvard dot edu>
- Date: Wed, 16 Sep 1998 12:56:52 -0400
- Reply-To: mhagger at blizzard dot harvard dot edu
Hi,
I get a spurious warning from egcs 1.1a. I don't see how `double x'
could be thought to be uninitialized in function f. See the following
transcript for details.
======================================================================
$ uname -a
OSF1 tsunami.harvard.edu V4.0 564 alpha
$ e++ -v
Reading specs from /usr/local/egcs-1.1a/lib/gcc-lib/alpha-dec-osf4.0b/egcs-2.91.57/specs
gcc version egcs-2.91.57 19980901 (egcs-1.1 release)
$ cat bugtestii.cc
struct A
{
virtual ~A();
};
struct B
{
virtual ~B();
};
struct C
{
int g(const B &);
};
struct D : public A
{
struct E : public B {};
};
double f()
{
D d;
C c;
double x = 0.0;
do {
} while (c.g(D::E()));
return x;
}
$ e++ -W -O2 -c bugtestii.cc
bugtestii.cc: In function `double f()':
bugtestii.cc:27: warning: `double x' might be used uninitialized in this function
$
======================================================================
My compiler was built with the following commands (unpatched source):
======================================================================
# made directory ~/download/egcs-1.1a-compilation and changed to it.
CC=ecc nice -2 ../egcs-1.1a/configure --prefix=/usr/common/egcs-1.1a --exec-prefix=/usr/local/egcs-1.1a --enable-shared
nice -2 make CFLAGS='-O' LIBCFLAGS='-g -O2' LIBCXXFLAGS='-g -O2 -fno-implicit-templates' bootstrap
sudo nice -2 make install
ln -s /usr/local/egcs-1.1a/bin/c++ /usr/local/bin/e++
======================================================================
I hope this helps.
Michael
--
Michael Haggerty
mhagger@blizzard.harvard.edu