[LLVMbugs] [Bug 18363] clang crashes on valid code at -O0 with -ftrapv (affecting all clang versions)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jan 9 19:59:42 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=18363

Bill Wendling <isanbard at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Bill Wendling <isanbard at gmail.com> ---
(In reply to comment #2)
> Bill, I don't think that this has been fixed really. The crash is indeed
> gone, but the inconsistent behavior doesn't seem desired --- the code is
> rejected at -O0, but accepted at -O1 and above. 
> 
> Please see below: 
> 
> $ clang-trunk -v
> clang version 3.5 (trunk 198876)
> Target: x86_64-unknown-linux-gnu
> Thread model: posix
> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.6
> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.3
> Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
> $ 
> $ clang-trunk -O0 -ftrapv -c small.c
> error: argument to '__builtin_return_address' must be a constant integer
> 1 error generated.
> $ 
> $ clang-trunk -O1 -ftrapv -c small.c
> $

The documentation explicitly says that it must be a constant integer. You
passed in an expression, which means that it's an error. The fact that it gets
folded at higher optimizations levels is irrelevant.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140110/d563f085/attachment.html>


More information about the llvm-bugs mailing list