gcc/testsuite/c-c++-common/ubsan/undefined-2.c
raw| 1 | /* { dg-do run } */ |
| 2 | /* { dg-options "-fsanitize=undefined -fno-sanitize-recover=signed-integer-overflow" } */ |
| 3 | /* { dg-additional-options "-std=gnu11" { target c } } */ |
| 4 | /* { dg-additional-options "-std=c++11" { target c++ } } */ |
| 5 | |
| 6 | volatile int w, z; |
| 7 | |
| 8 | __attribute__ ((noinline, noclone)) int |
| 9 | foo (int x, int y) |
| 10 | { |
| 11 | z++; |
| 12 | return x << y; |
| 13 | } |
| 14 | |
| 15 | int |
| 16 | main () |
| 17 | { |
| 18 | w = foo (0, -__INT_MAX__); |
| 19 | return 0; |
| 20 | } |
| 21 | |
| 22 | /* { dg-output "shift exponent -\[^\n\r]* is negative" } */ |