This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/12815] [3.3/3.4 Regression] Code compiled with optimization behaves unexpectedly
- From: "ebotcazou at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Dec 2003 14:12:47 -0000
- Subject: [Bug c++/12815] [3.3/3.4 Regression] Code compiled with optimization behaves unexpectedly
- References: <20031028154158.12815.boris@kolpackov.net>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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