2018-04-09 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / pr66066-1.c
blob7a1d342c808a294165facc2899c12e2cdf3b56f7
1 /* PR c/66066 */
2 /* { dg-do compile } */
3 /* { dg-options "-Wno-div-by-zero" } */
5 /* Accept these unless -pedantic-errors/-Werror. */
6 int a1 = -1 << 0;
7 int a2 = -1 << 0 | 0;
8 int a3 = -1 << 0 & 1;
9 int a4 = -1 << 2 ^ 1;
10 int a5 = 4 & -1 << 2;
11 int a6 = (-1 << 2) ^ (1 >> 1);
12 int a7 = 0 || (-1 << 1);
13 int a8 = 0 ? 2 : (-1 << 1);
14 int a9 = 1 && -1 << 0;
15 int a10 = !(-1 << 0);
17 /* Don't accept these. */
18 int b1 = 1 / 0; /* { dg-error "initializer element is not constant" } */
19 int b2 = 1 / (1 / 0); /* { dg-error "initializer element is not constant" } */
20 int b3 = 0 ? 2 : 1 / 0; /* { dg-error "initializer element is not constant" } */
21 int b4 = 0 || 1 / 0; /* { dg-error "initializer element is not constant" } */
22 int b5 = 0 * (1 / 0); /* { dg-error "initializer element is not constant" } */
23 int b6 = 1 * (1 / 0); /* { dg-error "initializer element is not constant" } */
24 int b7 = (1 / 0) * 0; /* { dg-error "initializer element is not constant" } */
25 int b8 = (1 / 0) * 1; /* { dg-error "initializer element is not constant" } */
26 int b9 = 1 && 1 / 0; /* { dg-error "initializer element is not constant" } */
27 int b10 = !(1 / 0); /* { dg-error "initializer element is not constant" } */
28 int c1 = 1 % 0; /* { dg-error "initializer element is not constant" } */
29 int c2 = 1 / (1 % 0); /* { dg-error "initializer element is not constant" } */
30 int c3 = 0 ? 2 : 1 % 0; /* { dg-error "initializer element is not constant" } */
31 int c4 = 0 || 1 % 0; /* { dg-error "initializer element is not constant" } */
32 int c5 = 0 * (1 % 0); /* { dg-error "initializer element is not constant" } */
33 int c6 = 1 * (1 % 0); /* { dg-error "initializer element is not constant" } */
34 int c7 = (1 % 0) * 0; /* { dg-error "initializer element is not constant" } */
35 int c8 = (1 % 0) * 1; /* { dg-error "initializer element is not constant" } */
36 int c9 = 1 && 1 % 0; /* { dg-error "initializer element is not constant" } */
37 int c10 = !(1 % 0); /* { dg-error "initializer element is not constant" } */