2005-10-18 Daniel Berlin <dberlin@dberlin.org>
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / pr24287.c
blob8e7f18691dc75ff576d66c671764bdc037c0b259
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-optimized" } */
3 int g1(int);
4 int h(int *a, int *b)__attribute__((pure));
5 void link_error();
7 /* The calls to link_error should be eliminated, since nothing escapes to
8 non-pure functions. */
9 int g(void)
11 int t = 0, t1 = 2;
12 int t2 = h(&t, &t1);
13 if (t != 0)
14 link_error ();
15 if (t1 != 2)
16 link_error ();
17 g1(t2);
18 if (t != 0)
19 link_error ();
20 if (t1 != 2)
21 link_error ();
22 return t2 == 2;
24 /* { dg-final { scan-tree-dump-times "link_error" 0 "optimized"} } */
25 /* { dg-final { cleanup-tree-dump "optimized" } } */