Merge reload-branch up to revision 101000
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / pr21985.c
blobe94031045b45a0e75b3076e23f0b1b40883a3efd
1 /* { dg-do compile } */
2 /* { dg-options "-O1 -fdump-tree-vars" } */
4 struct
6 struct
8 int a;
9 int b;
10 } a[100];
11 } a;
13 void foo(unsigned);
14 unsigned *bar (void);
16 int
17 main (void)
19 unsigned *b = bar ();
21 /* This should be folded. */
22 foo (&a.a[50].a - &a.a[33].b);
23 foo ((unsigned) &a.a[50].b - (unsigned) &a);
25 /* And this should not. */
26 foo ((unsigned) &b - (unsigned) b);
27 return 0;
30 /* Two of the calls to foo should be folded to just foo(constant). */
32 /* { dg-final { scan-tree-dump-times "foo \\(\[0-9\]*\\)" 2 "vars" } } */