[LLVMbugs] [Bug 13768] New: C++ exceptions are not catched on ARM (core is dumped)
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Sep 4 16:54:52 PDT 2012
http://llvm.org/bugs/show_bug.cgi?id=13768
Bug #: 13768
Summary: C++ exceptions are not catched on ARM (core is dumped)
Product: new-bugs
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: new bugs
AssignedTo: unassignedbugs at nondot.org
ReportedBy: liangh at quicinc.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 9157
--> http://llvm.org/bugs/attachment.cgi?id=9157
assembly and IR dump
LLVM can not generate correct code for exception handling on ARM. Core is
dumped at run-time. Please see below for the testcase "throw.cpp".
#######################
## src:
#######################
include <iostream>
using namespace std;
int foo(){
throw -15;
}
int main () {
try{
foo();
cout <<"Should not be here" << endl;
}
catch(...){
cout <<" Exception caught" << endl;
}
}
#######################
## compile-1:
#######################
clang++ -mfloat-abi=softfp -mfpu=neon -ccc-gcc-name arm-cross-g++ -o throw
-O0 throw.cpp
## run result:
terminate called after throwing an instance of 'int'
Aborted (core dumped)
## Stack:
Program received signal SIGABRT, Aborted.
0x00069590 in raise ()
#1 0x00069790 in abort ()
#2 0x00048ff8 in __gnu_cxx::__verbose_terminate_handler() ()
#3 0x00048ba8 in __cxxabiv1::__terminate(void (*)()) ()
#4 0x00048bd0 in std::terminate() ()
#5 0x00046988 in __cxa_throw ()
#6 0x00008f04 in foo () at throw.cpp:5
#######################
The problem is that the catch-related calls are missing in the assembly. Please
see attached "throw.s". With "-print-after-all", we can see that all
catch-related calls are removed by the pass "Remove unreachable blocks from the
CFG". Please see attached "throw.print"
By adding the flag "-mllvm -arm-enable-ehabi", the catch-related code is kept
in assembly, but the executable still abort with a core dumped. Please see
below and the attached "throw-ehabi.s" and "throw-ehabi.print" for details.
#######################
## compile-2 (-mllvm -arm-enable-ehabi):
#######################
clang++ -mfloat-abi=softfp -mfpu=neon -ccc-gcc-name arm-cross-g++ -o throw
-O0 -mllvm -arm-enable-ehabi throw.cpp
## run result:
Aborted (core dumped)
## Stack:
Program received signal SIGABRT, Aborted.
0x00069620 in raise ()
#1 0x00069820 in abort ()
#2 0x00060c40 in _Unwind_GetDataRelBase ()
#3 0x00048574 in __gxx_personality_v0 ()
#4 0x0006010c in __gnu_Unwind_RaiseException ()
#5 0x000603d4 in ___Unwind_RaiseException ()
#6 0x00046a08 in __cxa_throw ()
#7 0x00008f04 in foo () at throw.cpp:5
#######################
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list