don't read Block after it is freed. This fixes PR1684
authorChris Lattner <sabre@nondot.org>
Fri, 21 Sep 2007 18:25:53 +0000 (18:25 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 21 Sep 2007 18:25:53 +0000 (18:25 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42204 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/DwarfWriter.cpp

index 121ef1d9e87695c6ac1b0175f094f393e80ec882..ed4de7d662b0c81121d3f9e2ab02406fab9ddf37 100644 (file)
@@ -1301,7 +1301,9 @@ public:
       ValuesSet.InsertNode(Value, Where);
       Values.push_back(Value);
     } else {
+      // Already exists, reuse the previous one.
       delete Block;
+      Block = cast<DIEBlock>(Value);
     }
   
     Die->AddValue(Attribute, Block->BestForm(), Value);