1 /* PR sanitizer/60613 */
2 /* { dg-do run } */
3 /* { dg-options "-fsanitize=undefined" } */
4 
5 long long y;
6 
7 __attribute__((noinline, noclone)) long long
foo(long long x)8 foo (long long x)
9 {
10   asm ("");
11   if (x >= 0 || x < -2040)
12     return 23;
13   x += 2040;
14   return x - y;
15 }
16 
17 __attribute__((noinline, noclone)) long long
bar(long long x)18 bar (long long x)
19 {
20   asm ("");
21   return 8LL - x;
22 }
23 
24 int
main()25 main ()
26 {
27   y = -__LONG_LONG_MAX__ + 6;
28   if (foo (8 - 2040) != -__LONG_LONG_MAX__)
29     __builtin_abort ();
30   if (bar (-__LONG_LONG_MAX__ + 5) != -__LONG_LONG_MAX__ + 1)
31     __builtin_abort ();
32   return 0;
33 }
34 
35 /* { dg-output "signed integer overflow: 8 \\- -9223372036854775801 cannot be represented in type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
36 /* { dg-output "\[^\n\r]*signed integer overflow: 8 \\- -9223372036854775802 cannot be represented in type 'long long int'" } */
37