diff options
Diffstat (limited to 'gcc-4.9/gcc/testsuite/c-c++-common/ubsan/div-by-zero-3.c')
-rw-r--r-- | gcc-4.9/gcc/testsuite/c-c++-common/ubsan/div-by-zero-3.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/div-by-zero-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/div-by-zero-3.c new file mode 100644 index 000000000..399071ee7 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/div-by-zero-3.c @@ -0,0 +1,21 @@ +/* { dg-do run } */ +/* { dg-options "-fsanitize=integer-divide-by-zero -Wno-overflow" } */ + +#include <limits.h> + +int +main (void) +{ + volatile int min = INT_MIN; + volatile int zero = 0; + + INT_MIN / -1; + min / -1; + min / (10 * zero - (2 - 1)); + + return 0; +} + +/* { dg-output "division of -2147483648 by -1 cannot be represented in type 'int'(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*division of -2147483648 by -1 cannot be represented in type 'int'(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*division of -2147483648 by -1 cannot be represented in type 'int'" } */ |