[llvm-commits] [dragonegg] r95504 - /dragonegg/trunk/llvm-convert.cpp

Duncan Sands baldrick at free.fr
Sat Feb 6 12:55:13 PST 2010


Author: baldrick
Date: Sat Feb  6 14:55:13 2010
New Revision: 95504

URL: http://llvm.org/viewvc/llvm-project?rev=95504&view=rev
Log:
Do not crash if a nested function takes the address of a label in a
containing function.  Observed with GCC testcases nested-4.c, nested-5.c
and nested-6.c.

Modified:
    dragonegg/trunk/llvm-convert.cpp

Modified: dragonegg/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=95504&r1=95503&r2=95504&view=diff

==============================================================================
--- dragonegg/trunk/llvm-convert.cpp (original)
+++ dragonegg/trunk/llvm-convert.cpp Sat Feb  6 14:55:13 2010
@@ -1051,7 +1051,13 @@
   if (DECL_LOCAL_SET_P(LabelDecl))
     return cast<BasicBlock>(DECL_LOCAL(LabelDecl));
 
-  BasicBlock *BB = getBasicBlock(label_to_block(LabelDecl));
+  basic_block bb = label_to_block(LabelDecl);
+  if (!bb) {
+    sorry("addresses of non-local labels not supported by LLVM");
+    bb = ENTRY_BLOCK_PTR; // Do not crash.
+  }
+
+  BasicBlock *BB = getBasicBlock(bb);
   SET_DECL_LOCAL(LabelDecl, BB);
   return BB;
 }





More information about the llvm-commits mailing list