https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66738

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-07-02
                 CC|                            |hubicka at gcc dot gnu.org,
                   |                            |jamborm at gcc dot gnu.org
          Component|tree-optimization           |ipa
   Target Milestone|---                         |5.2
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed (with the old libstdc++ ABI).  -O1 works.  We segfault in libgcc:

Program received signal SIGSEGV, Segmentation fault.
_Unwind_Resume (exc=exc@entry=0x0)
    at /space/rguenther/tramp3d/trunk/libgcc/unwind.inc:229
229       if (exc->private_1 == 0)
(gdb) bt
#0  _Unwind_Resume (exc=exc@entry=0x0)
    at /space/rguenther/tramp3d/trunk/libgcc/unwind.inc:229
#1  0x0000000000400ad0 in main () at t.C:37

We optimize main to

Eh tree:
   1 cleanup
     3 cleanup land:{2,<L4>}

  <bb 2>:
  _3 = __cxa_allocate_exception (24);
  MEM[(struct MyException *)_3].D.12544._vptr.exception = &MEM[(void
*)&_ZTV11MyException + 16B];
  _7 = &MEM[(struct MyException *)_3].m_reason;
  std::basic_string<char>::basic_string (_7, "No!", &D.13102);
;;    succ:       3 [100.0%]  (FALLTHRU,EXECUTABLE)
;;                4 (EH,EXECUTABLE)

  <bb 3>:
  D.13102 ={v} {CLOBBER};
  MEM[(struct _Alloc_hider *)_3 + 16B]._M_p = &MEM[(void
*)&_S_empty_rep_storage + 24B];
  __builtin_unreachable ();

<L4>:
  D.13102 ={v} {CLOBBER};
  _18 = &MEM[(struct MyException *)_3].D.12544;
  std::exception::~exception (_18);
  __builtin_eh_copy_values (1, 3);
  __cxa_free_exception (_3);
  _9 = __builtin_eh_pointer (1);
  __builtin_unwind_resume (_9);


but the std::string constructor doesn't throw and thus we run into the
__builtin_unreachable ().

t.C.068t.fixup_cfg4:  __builtin_unreachable ();

is where that appears.  It's from devirtualization:

ipa-prop: Discovered a virtual call to a known target (void
MyException::updateMessage()/143 -> void __builtin_unreachable()/264), for stmt
_8 = OBJ_TYPE_REF(_6;this_2(D)->3) (this_2(D));
t.C:25:37: note: converting indirect call in void MyException::updateMessage()
to direct call to void __builtin_unreachable()
Speculative indirect call void MyException::updateMessage()/143 => virtual
const string& MyException::exceptionName() const/265 has turned out to have
contradicting known target __builtin_unreachable

Reply via email to