]> granicus.if.org Git - clang/commitdiff
Tame an assert; the scope depth of a jump destination does not
authorJohn McCall <rjmccall@apple.com>
Fri, 25 Feb 2011 04:19:13 +0000 (04:19 +0000)
committerJohn McCall <rjmccall@apple.com>
Fri, 25 Feb 2011 04:19:13 +0000 (04:19 +0000)
necessarily enclose the innermost normal cleanup depth, because
the top of the jump scope stack might be an EH cleanup or EH scope.
Fixes PR9303.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126472 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGCleanup.cpp
test/CodeGenCXX/exceptions.cpp

index 374ede880d20679c9f9590c796447b938196ce00..1d7901a2db4cd1b796762b929f5bc56fee71b402 100644 (file)
@@ -876,7 +876,7 @@ void CodeGenFunction::PopCleanupBlock(bool FallthroughIsBranchThrough) {
 ///
 /// As a side-effect, this method clears the insertion point.
 void CodeGenFunction::EmitBranchThroughCleanup(JumpDest Dest) {
-  assert(Dest.getScopeDepth().encloses(EHStack.getInnermostNormalCleanup())
+  assert(Dest.getScopeDepth().encloses(EHStack.stable_begin())
          && "stale jump destination");
 
   if (!HaveInsertPoint())
index 84d55c8f19071d971c9320263329d66e932a6ef8..80818189f48b603847f2e89e8989da731f22930d 100644 (file)
@@ -293,3 +293,15 @@ namespace test5 {
     }
   }
 }
+
+// PR9303: invalid assert on this
+namespace test6 {
+  bool cond();
+  void test() {
+    try {
+    lbl:
+      if (cond()) goto lbl;
+    } catch (...) {
+    }
+  }
+}