blob: fa074e7426a971bc9489d5527a3acfc8dd5c0387 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
/* PR sanitizer/109107 */
/* { dg-do run { target int32 } } */
/* { dg-options "-fsanitize=signed-integer-overflow" } */
#define INT_MIN (-__INT_MAX__ - 1)
const int a = INT_MIN;
const int b = 40;
int d = 1;
__attribute__((noipa)) int
foo ()
{
int c = a - d + (int) (short) b;
return c;
}
int
main ()
{
foo ();
return 0;
}
/* { dg-output "signed integer overflow: -2147483648 - 1 cannot be represented in type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
/* { dg-output "\[^\n\r]*signed integer overflow: 2147483647 \\+ 40 cannot be represented in type 'int'" } */
|