Mercurial > hg > CbC > CbC_gcc
annotate gcc/testsuite/gcc.dg/no-strict-overflow-8.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
rev | line source |
---|---|
111 | 1 /* { dg-do compile } */ |
2 /* { dg-options "-fno-strict-overflow -O2 -fdump-tree-optimized" } */ | |
3 | |
4 /* We cannot fold i > 0 because p->a - p->b can be larger than INT_MAX | |
5 and thus i can wrap. Dual of Wstrict-overflow-18.c */ | |
6 | |
7 struct c { unsigned int a; unsigned int b; }; | |
8 extern void bar (struct c *); | |
9 int | |
10 foo (struct c *p) | |
11 { | |
12 int i; | |
13 int sum = 0; | |
14 | |
15 for (i = 0; i < p->a - p->b; ++i) | |
16 { | |
17 if (i > 0) | |
18 sum += 2; | |
19 bar (p); | |
20 } | |
21 return sum; | |
22 } | |
23 | |
24 /* { dg-final { scan-tree-dump "i_.* > 0" "optimized" } } */ |