PR tree-optimization/81303
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / ssa-ccp-15.c
blob3ee703b72915343edcfc7cf00f0933e03d5e4038
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-optimized" } */
4 /* Check that the initial values are honored when necessary. */
6 void link_error (void);
8 /* The call to link_error cannot be eliminated in this case. */
10 void test1 (int param1, int param2, int x)
12 if (param1)
13 x = 3;
15 if (param2)
16 if (x != 3)
17 link_error ();
20 /* The call to link_error cannot be eliminated in this case. */
22 int global;
23 void test2 (int param1, int param2)
25 if (param1)
26 global = 3;
28 if (param2)
29 if (global != 3)
30 link_error ();
33 /* In this case, we can eliminate the call, as unless "local" is set
34 to 3, its value is undefined. */
36 void test3 (int param1, int param2)
38 int local;
40 if (param1)
41 local = 3;
43 if (param2)
44 if (local != 3)
45 link_error ();
48 /* { dg-final { scan-tree-dump-times "link_error" 2 "optimized" } } */