OSDN Git Service

Fix PR42205.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / Wstrict-overflow-12.c
1 /* { dg-do compile } */
2 /* { dg-options "-fstrict-overflow -O2 -Wstrict-overflow=2" } */
3
4 /* Source: Ian Lance Taylor.  Dual of no-strict-overflow-6.c.  */
5
6 /* VRP test.  This turns into an infinite loop when using strict
7    overflow semantics.  */
8
9 int
10 foo ()
11 {
12   int i, bits;
13   for (i = 1, bits = 1; i > 0; i += i) /* { dg-warning "assuming signed overflow does not occur" "correct warning" } */
14     ++bits;
15   return bits;
16 }