[cfe-dev] -ftrapv flag leads to compilation error
peng li
peterlee at cs.utah.edu
Tue May 11 15:09:34 PDT 2010
Hi there
First I used command "clang -o add add.c -ftrapv" to compile the add.c
which implements two signed integers add operation leading to overflow.
But clang can not compile successfully. The concrete error
message is pasted as follows:
/tmp/cc-oMjvJr.o: In function `main':
add.c:(.text+0x3b): undefined reference to `__overflow_handler'
collect2: ld returned 1 exit status
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
Then I also extended the command to "clang -o add add.c -ftrapv -S
-emit-llvm" and found the dynamic checks have been expressed and
instrumented into the corresponding LLVM code. I think those checks,
such as "overflow", "overflow.continue" should also be considered as the
dynamic undefined behavior checks, correct?? Since resorting to those
checks, clang will not dump the warnings at compile time.
Regards
Peng
More information about the cfe-dev
mailing list