PR tree-optimization/81303
[official-gcc.git] / gcc / testsuite / gcc.dg / pr59871.c
blobc881aa198d513e46dc6da9dd5f9a0d8e8a5df2fa
1 /* PR c/59871 */
2 /* { dg-do compile } */
3 /* { dg-options "-Wunused" } */
5 extern int bar ();
7 void
8 foo (int *p, int i)
10 p[0] = (bar (), 1, bar ()); /* { dg-warning "right-hand operand of comma expression has no effect" } */
11 p[1] = (1, bar ()); /* { dg-warning "left-hand operand of comma expression has no effect" } */
12 bar (), 1, bar (); /* { dg-warning "right-hand operand of comma expression has no effect" } */
13 bar (), 1; /* { dg-warning "right-hand operand of comma expression has no effect" } */
14 1, bar (); /* { dg-warning "left-hand operand of comma expression has no effect" } */
15 (bar (), 1); /* { dg-warning "right-hand operand of comma expression has no effect" } */
16 bar (), 5 * i; /* { dg-warning "right-hand operand of comma expression has no effect" } */
17 (bar (), 5 * i); /* { dg-warning "right-hand operand of comma expression has no effect" } */
18 (bar (), (bar (), (bar (), (bar (), (bar (), (bar (), (bar (), 7))))))); /* { dg-warning "right-hand operand of comma expression has no effect" } */
19 bar (), (bar (), (bar (), (bar (), (bar (), (bar (), (bar (), 7)))))); /* { dg-warning "right-hand operand of comma expression has no effect" } */
20 bar (), (bar (), (bar (), (bar (), (bar (), (bar (), (7, bar ())))))); /* { dg-warning "left-hand operand of comma expression has no effect" } */
21 (bar (), (bar (), (bar (), (bar (), (bar (), (bar (), (7, bar ()))))))); /* { dg-warning "left-hand operand of comma expression has no effect" } */