PR middle-end/85602 - -Wsizeof-pointer-memaccess for strncat with size of source
[official-gcc.git] / gcc / testsuite / c-c++-common / pr56607.c
blobba1395612da3a08ddc220373beddf7e5708c0494
1 /* PR c++/56607 */
2 /* { dg-do compile { target { { lp64 || ilp32 } || llp64 } } } */
3 /* { dg-options "-O2 -Wdiv-by-zero" } */
5 int
6 f1 (void)
8 return 1 / (sizeof (char) - 1); /* { dg-warning "division by zero" } */
11 int
12 f2 (void)
14 const int x = sizeof (char) - 1;
15 return 1 / x; /* { dg-warning "division by zero" } */
18 int
19 f3 (void)
21 return 1 / (sizeof (int) / 3 - 1); /* { dg-warning "division by zero" } */
24 int
25 f4 (void)
27 const int x = sizeof (int) / 3 - 1;
28 return 1 / x; /* { dg-warning "division by zero" } */