annotate gcc/testsuite/gcc.dg/tree-ssa/pr24287.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* { dg-do compile } */
kono
parents:
diff changeset
2 /* { dg-options "-O2 -fdump-tree-optimized" } */
kono
parents:
diff changeset
3 int g1(int);
kono
parents:
diff changeset
4 int h(int *a, int *b)__attribute__((pure));
kono
parents:
diff changeset
5 void link_error();
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 /* The calls to link_error should be eliminated, since nothing escapes to
kono
parents:
diff changeset
8 non-pure functions. */
kono
parents:
diff changeset
9 int g(void)
kono
parents:
diff changeset
10 {
kono
parents:
diff changeset
11 int t = 0, t1 = 2;
kono
parents:
diff changeset
12 /* ??? That's not true. The pointers escape to the integer return
kono
parents:
diff changeset
13 value which we do not track in PTA. */
kono
parents:
diff changeset
14 int t2 = h(&t, &t1);
kono
parents:
diff changeset
15 if (t != 0)
kono
parents:
diff changeset
16 link_error ();
kono
parents:
diff changeset
17 if (t1 != 2)
kono
parents:
diff changeset
18 link_error ();
kono
parents:
diff changeset
19 /* ??? And it would finally escape here even if we did. */
kono
parents:
diff changeset
20 g1(t2);
kono
parents:
diff changeset
21 if (t != 0)
kono
parents:
diff changeset
22 link_error ();
kono
parents:
diff changeset
23 if (t1 != 2)
kono
parents:
diff changeset
24 link_error ();
kono
parents:
diff changeset
25 return t2 == 2;
kono
parents:
diff changeset
26 }
kono
parents:
diff changeset
27 /* We are allowed to optimize the first two link_error calls. */
kono
parents:
diff changeset
28 /* { dg-final { scan-tree-dump-times "link_error" 2 "optimized" } } */