optimzer bug [?]

John F. Dumas jdumas@locutus.kingwoodcable.com
Sun Dec 5 09:47:00 GMT 1999


#include <iostream.h>

class Base
{
   public:
      virtual ~Base() {}
      virtual void doit() = 0;
};

int function()
{
   class Derived : public Base
   {
      public:
         void doit() { cout << "doit\n"; }
   };

   Derived d;
   d.doit();
}

int main()
{
   function();
   return(0);
}

When I compile the above code with g++ 2.95 on linux without optimization
it compiles/works fine but when I compile with optimization I get:

/tmp/ccyRy6NQ.o(.gnu.linkonce.d.__vt_Q214function__Fv.0_7Derived+0x8): undefined
 reference to `_._Q214function__Fv.0_7Derived.424'
/tmp/ccyRy6NQ.o(.gnu.linkonce.d.__vt_Q214function__Fv.0_7Derived+0xc): undefined
 reference to `doit__Q214function__Fv.0_7Derived.423'

I'll be happy to supply more details should they be needed but this one's
so straightforward to reproduce I doubt you'll need them, thanks!

//***********************************************************************
//  John F. Dumas                           Contract Software Developer
//  5311 Jasper Grove     Unix, Win32, Web - C/C++, Java, CGI Scripting
//  Kingwood TX, 77345      jdumas[at]locutus[dot]kingwoodcable[dot]com
//  (281)-360-9264                    http://locutus.kingwoodcable.com/
//***********************************************************************



More information about the Gcc-bugs mailing list