craig.topper added a comment.

In D156821#4600550 <https://reviews.llvm.org/D156821#4600550>, @MaskRay wrote:

>> Currenly both Clang and GCC support the following set of flags that control
>
> code gen of signed overflow:
>
>> [...]
>> Howerver, clang ignores these flags for __builtin_abs(int) and its 
>> higher-width
>
> versions, so passing minimum integer value always causes poison.
>
> This paragraph reads as if GCC emits a trap for `__builtin_abs` in -ftrapv 
> mode, but it doesn't. That said, its `-fsanitize=signed-integer-overflow` 
> does handle `__builtin_abs`.

On X86 at least, gcc does call `__negvsi2` for __builtin_abs under -ftrapv. 
https://godbolt.org/z/8dhn9bsv5


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156821/new/

https://reviews.llvm.org/D156821

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to