re PR tree-optimization/33291 (a+=2; a+=2 not simplified to a+=4; with -O3 ...
[gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / 20030710-1.c
1 /* { dg-do compile } */
2 /* { dg-options "-O1 -fdump-tree-dom3" } */
3
4 extern void abort (void);
5 union tree_node;
6 typedef union tree_node *tree;
7 struct tree_vec
8 {
9 int length;
10 tree a[1];
11 };
12 struct tree_type
13 {
14 tree binfo;
15 };
16 union tree_node
17 {
18 struct tree_type type;
19 struct tree_vec vec;
20 };
21 void
22 record_component_aliases (type)
23 tree type;
24 {
25 if (type->type.binfo->vec.length)
26 abort ();
27 for (; ((
28 {
29 const tree __z = type->type.binfo;
30 if (type->type.binfo->vec.length)
31 abort ();
32 type->type.binfo->vec.a[4];}
33 )->vec.length);)
34 {
35 if (4 >= type->type.binfo->vec.length)
36 abort ();
37 blah ();
38 }
39 }
40
41 /* The call to blah should have been eliminated. If the call is not
42 eliminated, then dominator optimizations failed and it'll be
43 impossible to delete other unnecessary code. */
44 /* { dg-final { scan-tree-dump-not "blah \\(\\)" "dom3" } } */
45
46 /* There should be two IF conditionals. */
47 /* { dg-final { scan-tree-dump-times "if " 2 "dom3"} } */
48
49 /* There should be a single load of type.binfo. */
50 /* { dg-final { scan-tree-dump-times "type\\.binfo" 1 "dom3"} } */
51
52 /* There should be two loads of vec.length. */
53 /* { dg-final { scan-tree-dump-times "vec.length" 2 "dom3"} } */
54
55 /* { dg-final { cleanup-tree-dump "dom3" } } */