]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/c-c++-common/ubsan/float-div-by-zero-1.c
* gcc.c (sanitize_spec_function): Handle SANITIZE_FLOAT_DIVIDE.
[thirdparty/gcc.git] / gcc / testsuite / c-c++-common / ubsan / float-div-by-zero-1.c
1 /* { dg-do run } */
2 /* { dg-options "-fsanitize=float-divide-by-zero" } */
3
4 int
5 main (void)
6 {
7 volatile float a = 1.3f;
8 volatile double b = 0.0;
9 volatile int c = 4;
10 volatile float res;
11
12 res = a / b;
13 res = a / 0.0;
14 res = 2.7f / b;
15 res = 3.6 / (b = 0.0, b);
16 res = c / b;
17 res = b / c;
18
19 return 0;
20 }
21
22 /* { dg-output "division by zero\[^\n\r]*(\n|\r\n|\r)" } */
23 /* { dg-output "\[^\n\r]*division by zero\[^\n\r]*(\n|\r\n|\r)" } */
24 /* { dg-output "\[^\n\r]*division by zero\[^\n\r]*(\n|\r\n|\r)" } */
25 /* { dg-output "\[^\n\r]*division by zero\[^\n\r]*(\n|\r\n|\r)" } */
26 /* { dg-output "\[^\n\r]*division by zero\[^\n\r]*" } */