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]
Other format: [Raw text]

[Bug c++/12815] [3.3/3.4 Regression] Code compiled with optimization behaves unexpectedly


------- Additional Comments From ebotcazou at gcc dot gnu dot org  2003-12-03 14:12 -------
This is a C++ problem I think. It appears that the 'A' object is constructed
twice (or that two instances are constructed if this is the intended behaviour),
the first time for

  APtr ap (new A);

and the second time for

  if (exp)

The first instance is never used, only the second one through 'typeid'.


The problem is the following: because A has a vtable, a 'jump' instruction is
emitted inside the constructor to another insn of this constructor. Now the
'jump' inside the *second* constructor points to the insn which is targeted by
the 'jump' inside the *first* constructor, that is the 'label' of the first
constructor was reused for the second constructor. After that, all hell breaks
loose.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|optimization                |c++


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12815


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