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]

Re: c++: undefined local static variable



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

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