xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/switch-case-folding.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -emit-llvm-only
2*f4a2713aSLionel Sambuc // CHECK that we don't crash.
3*f4a2713aSLionel Sambuc 
main(void)4*f4a2713aSLionel Sambuc int main(void){
5*f4a2713aSLionel Sambuc 	int x = 12;
6*f4a2713aSLionel Sambuc 	// Make sure we don't crash when constant folding the case 4
7*f4a2713aSLionel Sambuc 	// statement due to the case 5 statement contained in the do loop
8*f4a2713aSLionel Sambuc 	switch (4) {
9*f4a2713aSLionel Sambuc 		case 4: do {
10*f4a2713aSLionel Sambuc                      switch (6)  {
11*f4a2713aSLionel Sambuc                        case 6: {
12*f4a2713aSLionel Sambuc                          case 5: x++;
13*f4a2713aSLionel Sambuc                        };
14*f4a2713aSLionel Sambuc                      };
15*f4a2713aSLionel Sambuc                 } while (x < 100);
16*f4a2713aSLionel Sambuc 	}
17*f4a2713aSLionel Sambuc 	return x;
18*f4a2713aSLionel Sambuc }
19