Update concepts branch to revision 131834
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / pr21985.c
blob19ad0f1132b476ccae092d589302155d1e7f732f
1 /* { dg-do compile } */
2 /* { dg-options "-O1 -fdump-tree-optimized" } */
4 struct
6 struct
8 int a;
9 int b;
10 } a[100];
11 } a;
13 typedef __SIZE_TYPE__ size_t;
14 void foo(size_t);
15 size_t *bar (void);
17 int
18 main (void)
20 size_t *b = bar ();
22 /* This should be folded. */
23 foo (&a.a[50].a - &a.a[33].b);
24 foo ((size_t) &a.a[50].b - (size_t) &a);
26 /* And this should not. */
27 foo ((size_t) &b - (size_t) b);
28 return 0;
31 /* Two of the calls to foo should be folded to just foo(constant). */
33 /* { dg-final { scan-tree-dump-times "foo \\(\[0-9\]*\\)" 2 "optimized" } } */
34 /* { dg-final { cleanup-tree-dump "optimized" } } */