re PR tree-optimization/33291 (a+=2; a+=2 not simplified to a+=4; with -O3 ...
[gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / pr25501.c
1 /* PR tree-optimization/25501
2 The PHI merge pass used to try to merge PHI nodes that cannot
3 actually merged, causing a segfault later. Make sure that does not
4 happen any more. */
5
6 /* { dg-options "-O1 -fdump-tree-mergephi" } */
7
8 int
9 foo (int a)
10 {
11 int b;
12 int c;
13 int d;
14
15 if (a == 2)
16 b = 3;
17 else
18 b = 5;
19
20 c = 7;
21
22 d = 11;
23
24 for (;;)
25 {
26 if (d == 5)
27 break;
28
29 d = b;
30 }
31
32 return 13;
33 }
34
35 /* { dg-final { scan-tree-dump-times "Removing basic block" 0 "mergephi1"} } */
36 /* { dg-final { cleanup-tree-dump "mergephi\[1-2\]" } } */