Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/c-c++-common/ubsan/overflow-sub-4.c @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 04ced10e8804 |
children |
line wrap: on
line source
/* { dg-do run } */ /* { dg-options "-fsanitize=signed-integer-overflow" } */ #define INT_MIN (-__INT_MAX__ - 1) int main () { int x = INT_MIN; int y = 0; int z; asm ("" : "+g" (y)); asm ("" : "+g" (x)); z = y - (-x); asm ("" : "+g" (z)); } /* { dg-output "negation of -2147483648 cannot be represented in type 'int'\[^\n\r]*; cast to an unsigned type to negate this value to itself\[^\n\r]*(\n|\r\n|\r)" } */ /* { dg-output "\[^\n\r]*signed integer overflow: 0 - -2147483648 cannot be represented in type 'int'" } */