This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++: undefined local static variable
- To: Mark Mitchell <mark at codesourcery dot com>
- Subject: Re: c++: undefined local static variable
- From: scott snyder <snyder at fnal dot gov>
- Date: 01 Aug 2000 13:56:31 -0500
- Cc: gcc-bugs at gcc dot gnu dot org
- References: <200007262155.QAA16464@d0sgibnl1.fnal.gov> <20000726215055S.mitchell@codesourcery.com>
Mark Mitchell <mark@codesourcery.com> writes:
> Interesting. This represents an improvement in a sense. In previous
> version of G++, we kept the `cleanup' variable, even though we didn't
> need it, since it was only used in an inline function we didn't emit.
> My patch caused us to stop emitting the variable (a good thing), but
> failed to stop us from emitting the associated cleanup function. This
> patch stops us from emitting the cleanup function, too.
hi -
Thanks for the fix. I tried it out last night, and it does indeed
fix the test case i sent in my earlier report. However, i hit on what
appears to be another variant of the same problem.
If i compile this source with today's cvs version
-------------------------------------------------------
struct basic_string
{
~basic_string();
};
struct Side
{
void name()
{
static basic_string sname;
}
};
-------------------------------------------------------
i get an undefined reference to the `sname' variable:
$ ./cc1plus -quiet x.cc
$ grep sname x.s
pushl $sname.3
thanks,
sss