[PATCH] D156821: [CodeGen] [ubsan] Respect integer overflow handling in abs builtin

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 18 16:35:01 PDT 2023


MaskRay added a comment.

> 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`.


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

https://reviews.llvm.org/D156821



More information about the cfe-commits mailing list