Disable gnat.dg/socket1.adb on hppa*-*-hpux*.
[official-gcc.git] / gcc / testsuite / c-c++-common / ubsan / overflow-mul-3.c
blob9bca1f8f5b9e5794fe1810413d1c47a412be029e
1 /* { dg-do run } */
2 /* { dg-options "-fsanitize=signed-integer-overflow -fno-sanitize-recover=signed-integer-overflow" } */
4 __attribute__((noinline, noclone)) long long
5 mul (long long x, long long y)
7 return x * y;
10 long long tab[] = {
11 0x7fffffffLL, 0x7fffffffLL, 0x3fffffff00000001LL,
12 -0x80000000LL, -0x80000000LL, 0x4000000000000000LL,
13 0x7fffffffLL, -0x80000000LL, -0x3fffffff80000000LL,
14 -0x80000000LL, 0x7fffffffLL, -0x3fffffff80000000LL,
15 3LL, 5LL, 15LL,
16 -3LL, -9LL, 27LL,
17 6LL, -7LL, -42LL,
18 -12LL, 13LL, -156LL,
19 0x1555555555555555LL, 6LL, 0x7ffffffffffffffeLL,
20 -0x1555555555555555LL, -6LL, 0x7ffffffffffffffeLL,
21 0x1555555555555555LL, -6LL, -0x7ffffffffffffffeLL,
22 -0x1555555555555555LL, 6LL, -0x7ffffffffffffffeLL,
23 0x81234567LL, 0xfdbe971fLL, 0x7fffffffbea72879LL,
24 -0x81234567LL, -0xfdbe971fLL, 0x7fffffffbea72879LL,
25 0x81234567LL, -0xfdbe971fLL, -0x7fffffffbea72879LL,
26 -0x81234567LL, 0xfdbe971fLL, -0x7fffffffbea72879LL
29 int
30 main ()
32 unsigned int i;
33 for (i = 0; i < sizeof (tab) / sizeof (long long); i += 3)
34 if (mul (tab[i], tab[i + 1]) != tab[i + 2]
35 || mul (tab[i + 1], tab[i]) != tab[i + 2])
36 __builtin_abort ();
37 return 0;