[LLVMbugs] [Bug 6974] New: -fno-rtti and 'try' / 'catch' causes clang to SIGSEGV (or assertion failure)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Apr 29 01:23:15 PDT 2010


           Summary: -fno-rtti and 'try' / 'catch' causes clang to SIGSEGV
                    (or assertion failure)
           Product: clang
           Version: 2.7
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: slyfox at inbox.ru
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com

Removing '-fno-rtti' allows this file to build properly.

g++ compiles file below successfully (-fexceptions and -fno-rtti was used in
original code to allow exception handling within modules, but disable things,
like 'dynamic_cast', 'typeinfo' and relevant strings in generated object files)

// $ cat try_error.cc 
 * clang++ -O0 -fexceptions -fno-rtti try_error.cc -emit-llvm -c

class err {};

void f (void)
    try {}
    catch( err & /* error */ )

Trying to build it:
$ clang++ -O0 -fexceptions -fno-rtti try_error.cc -emit-llvm -c            
Instruction referencing instruction not embedded in a basic block!
  %_rethrow = alloca i8*                          ; <i8**> [#uses=4]
  store i8* %exc1, i8** %_rethrow
Instruction referencing instruction not embedded in a basic block!
  %exc1 = call i8* @llvm.eh.exception()           ; <i8*> [#uses=3]
  store i8* %exc1, i8** %_rethrow
Broken module found, compilation aborted!
0  clang           0x000000000116281f
1  clang           0x000000000116303d
2  libpthread.so.0 0x00007f74bc948120
3  libc.so.6       0x00007f74bbc661a5 gsignal + 53
4  libc.so.6       0x00007f74bbc675d0 abort + 384
5  clang           0x0000000001113f5b
6  clang           0x00000000010f03d6
7  clang           0x00000000010f05b1
8  clang           0x00000000010f07de
9  clang           0x000000000041b8a5
10 clang           0x00000000005f83f4
11 clang           0x000000000041ef49
12 clang           0x00000000004123d9
13 clang           0x0000000000414e5b main + 1675
14 libc.so.6       0x00007f74bbc52bbd __libc_start_main + 253
15 clang           0x000000000040ff59
Stack dump:
0.      Program arguments: /usr/bin/clang -cc1 -triple x86_64-pc-linux-gnu
-emit-llvm-bc -disable-free -main-file-name try_error.cc -mrelocation-model
static -mdisable-fp-elim -mconstructor-aliases -munwind-tables -target-cpu
x86-64 -resource-dir /usr/lib/clang/1.1 -O0 -fmessage-length 127 -fexceptions
-fno-rtti -fgnu-runtime -fdiagnostics-show-option -fcolor-diagnostics -o
try_error.o -x c++ try_error.cc 
1.      <eof> parser at end of file
2.      Per-function optimization
3.      Running pass 'Module Verifier' on function '@_Z1fv'
clang: error: compiler command failed due to signal 6 (use -v to see

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