[LLVMdev] Strange exception code behavior: insertion of trace instructions makes result incorrect
Yuri
yuri at rawbw.com
Thu Jul 15 17:36:25 PDT 2010
Here is what I did: I took c.C (attached), compiled it into my.ll code
with command 'clang++ -O3 -fexceptions -emit-llvm -S -o my.ll c.C' and
added tracing command on every line, see attached my.ll
Running my.ll in interpreter with this command 'llvm-as my.ll && lli
-jit-enable-eh my.bc', I get this log:
TRACE num=20
TRACE num=22
TRACE num=27
TRACE num=29
TRACE num=31
TRACE num=33
TRACE num=58
TRACE num=60
TRACE num=62
TRACE num=64
TRACE num=66
TRACE num=70
TRACE num=72
Stack dump:
0. Program arguments: lli -jit-enable-eh my.bc
Bus error: 10
The line: TRACE num=72 is the next after _Unwind_Resume_or_Rethrow that
is marked noreturn.
Runing the same code as binary also bahaves in a similar way: 'llvm-as
my.ll && llc -o my.s my.bc && as -o my.o my.s && g++ -o my my.o && my':
TRACE num=20
TRACE num=22
TRACE num=27
TRACE num=29
TRACE num=31
TRACE num=33
TRACE num=58
TRACE num=60
TRACE num=62
TRACE num=64
TRACE num=66
TRACE num=70
TRACE num=72
TRACE num=134515344
Segmentation fault
Removing all calls to mytrace makes behavior correct.
Why I can't insert trace instructions? What is the state that is saved
between commands that causes such crashes?
Also only leaving one 'mytrace ' instruction before or after
llvm.eh.exception near the label lpad1 already causes the crash.
I think something is wrong with llvm.eh.exception and/or
llvm.eh.selector. Do they pass each other values in registers or
something like this?
Yuri
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: c.C
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100715/1741704f/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: my.ll
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100715/1741704f/attachment-0001.ksh>
More information about the llvm-dev
mailing list