re PR tree-optimization/33291 (a+=2; a+=2 not simplified to a+=4; with -O3 ...
[gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / ssa-ccp-12.c
1 /* { dg-do run } */
2 /* { dg-options "-O2" } */
3
4 struct A
5 {
6 int a;
7 int b;
8 };
9
10 struct A a;
11 const int B = 42;
12
13 void foo (int i)
14 {
15 if (i > 10)
16 a.a = 42;
17 else
18 {
19 a.b = 21;
20 a.a = a.b + 21;
21 }
22
23 /* This should be folded to 'if (0)' as a.a and B are both 42. */
24 if (a.a != B)
25 link_error ();
26 }
27
28 main ()
29 {
30 foo (3);
31 return 0;
32 }