1 /* { dg-do compile } */ 2 /* { dg-options "-O1 -fdump-tree-optimized" } */ 3 4 struct 5 { 6 struct 7 { 8 int a; 9 int b; 10 } a[100]; 11 } a; 12 13 typedef __SIZE_TYPE__ size_t; 14 void foo(size_t); 15 size_t *bar (void); 16 17 int main(void)18main (void) 19 { 20 size_t *b = bar (); 21 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); 25 26 /* And this should not. */ 27 foo ((size_t) &b - (size_t) b); 28 return 0; 29 } 30 31 /* Two of the calls to foo should be folded to just foo(constant). */ 32 33 /* { dg-final { scan-tree-dump-times "foo \\(\[0-9\]*\\)" 2 "optimized" } } */ 34