https://llvm.org/bugs/show_bug.cgi?id=23705

David Majnemer <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |[email protected]
         Resolution|---                         |INVALID

--- Comment #1 from David Majnemer <[email protected]> ---
Apple's distribution of clang is not supported on llvm.org.  That being said,
your code makes use of undefined behavior which permits clang to optimize it
ways which seem logically contradictory.

$ clang -fsanitize=undefined t.c -o t
$ ./t
t.c:12:24: runtime error: signed integer overflow: -2147483648 - 1073741823
cannot be represented in type 'int'
A

What this indicates is that GetB() - c results in undefined behavior because it
wraps.

If you want the compiler to give you two's complement results even when signed
integer overflow occurs, use -fwrapv.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to