* ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch
[official-gcc.git] / gcc / testsuite / c-c++-common / ubsan / pr56917.c
blobcfbae97c0c69c45a6ff43b7fcf562eed5c4b3039
1 /* PR middle-end/56917 */
2 /* { dg-do run } */
3 /* { dg-options "-fsanitize=undefined -fno-sanitize-recover=undefined" } */
5 #define INT_MIN (-__INT_MAX__ - 1)
6 #define LONG_MIN (-__LONG_MAX__ - 1L)
7 #define LLONG_MIN (-__LONG_LONG_MAX__ - 1LL)
9 int __attribute__ ((noinline,noclone))
10 fn1 (unsigned int u)
12 return (-(int) (u - 1U)) - 1;
15 long __attribute__ ((noinline,noclone))
16 fn2 (unsigned long int ul)
18 return (-(long) (ul - 1UL)) - 1L;
21 long long __attribute__ ((noinline,noclone))
22 fn3 (unsigned long long int ull)
24 return (-(long long) (ull - 1ULL)) - 1LL;
27 int
28 main (void)
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 ();