1/* PR middle-end/56917 */ 2/* { dg-do run } */ 3/* { dg-options "-fsanitize=undefined -fno-sanitize-recover=undefined" } */ 4 5#define INT_MIN (-__INT_MAX__ - 1) 6#define LONG_MIN (-__LONG_MAX__ - 1L) 7#define LLONG_MIN (-__LONG_LONG_MAX__ - 1LL) 8 9int __attribute__ ((noinline,noclone)) 10fn1 (unsigned int u) 11{ 12 return (-(int) (u - 1U)) - 1; 13} 14 15long __attribute__ ((noinline,noclone)) 16fn2 (unsigned long int ul) 17{ 18 return (-(long) (ul - 1UL)) - 1L; 19} 20 21long long __attribute__ ((noinline,noclone)) 22fn3 (unsigned long long int ull) 23{ 24 return (-(long long) (ull - 1ULL)) - 1LL; 25} 26 27int 28main (void) 29{ 30 if (fn1 (__INT_MAX__ + 1U) != INT_MIN 31 || fn2 (__LONG_MAX__ + 1UL) != LONG_MIN 32 || fn3 (__LONG_LONG_MAX__ + 1ULL) != LLONG_MIN) 33 __builtin_abort (); 34} 35