[cfe-commits] r148247 - /cfe/trunk/test/CodeGenCXX/switch-case-folding-1.cpp
Fariborz Jahanian
fjahanian at apple.com
Mon Jan 16 10:22:27 PST 2012
Author: fjahanian
Date: Mon Jan 16 12:22:26 2012
New Revision: 148247
URL: http://llvm.org/viewvc/llvm-project?rev=148247&view=rev
Log:
Another test for 148243
non-constant-folded-switch containing a constant-folded switch.
Added:
cfe/trunk/test/CodeGenCXX/switch-case-folding-1.cpp
Added: cfe/trunk/test/CodeGenCXX/switch-case-folding-1.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/switch-case-folding-1.cpp?rev=148247&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/switch-case-folding-1.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/switch-case-folding-1.cpp Mon Jan 16 12:22:26 2012
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 %s -emit-llvm-only
+// CHECK that we don't crash.
+
+int test(int val){
+ int x = 12;
+ // Make sure we don't crash when constant folding the case 4
+ // statement due to the case 5 statement contained in the do loop
+ switch (val) {
+ case 4: do {
+ switch (6) {
+ case 6: {
+ case 5: x++;
+ };
+ };
+ } while (x < 100);
+ }
+ return x;
+}
+
+int main(void) {
+ return test(4);
+}
More information about the cfe-commits
mailing list