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