https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71611
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Certainly not here. int f1 () { enum I { c = -__LONG_MAX__ - 1 } x = c; x = -x; return x; } int f2 () { enum J { c = -__INT_MAX__ - 1 } x = c; x = -x; return x; } int f3 () { int x = -__INT_MAX__ - 1; x = -x; return x; } int f4 () { enum { c = -__LONG_MAX__ - 1 } x = c; x = -x; return x; } int f5 () { enum { c = -__INT_MAX__ - 1 } x = c; x = -x; return x; } int main () { f1 (); f2 (); f3 (); f4 (); f5 (); return 0; } reports: pr71611.c:5:5: runtime error: negation of -9223372036854775808 cannot be represented in type 'I'; cast to an unsigned type to negate this value to itself pr71611.c:13:5: runtime error: negation of -2147483648 cannot be represented in type 'J'; cast to an unsigned type to negate this value to itself pr71611.c:21:5: runtime error: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself pr71611.c:29:5: runtime error: negation of -9223372036854775808 cannot be represented in type '<unknown>'; cast to an unsigned type to negate this value to itself pr71611.c:37:5: runtime error: negation of -2147483648 cannot be represented in type '<unknown>'; cast to an unsigned type to negate this value to itself GCC in the middle-end considers enums and integer types with the same sign and precision as compatible types, so there is no guarantee the types the sanitizer sees are the original ones, and changing that (making for -fsanitize=undefined conversion between different types not useless) would be way too costly for the generated code quality.