gcc/testsuite/c-c++-common/ubsan/pr82072-2.c
raw| 1 | /* PR sanitizer/82072 */ |
| 2 | /* { dg-do run } */ |
| 3 | /* { dg-options "-fsanitize=signed-integer-overflow" } */ |
| 4 | |
| 5 | int |
| 6 | main () |
| 7 | { |
| 8 | long long int l = -__LONG_LONG_MAX__ - 1; |
| 9 | unsigned int u; |
| 10 | u = -l; |
| 11 | asm volatile ("" : "+r" (u)); |
| 12 | return 0; |
| 13 | } |
| 14 | |
| 15 | /* { dg-output "negation of -9223372036854775808 cannot be represented in type 'long long int'\[^\n\r]*; cast to an unsigned type to negate this value to itself" } */ |