Merge aosp-toolchain/gcc/gcc-4_9 changes.
[official-gcc.git] / gcc-4_9 / gcc / testsuite / c-c++-common / pr56607.c
blobd7faa81151a261024b06f3b9156ac60cd5da9f8c
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" "" { target c++ } } */
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" "" { target c++ } } */