[cfe-commits] r69298 - /cfe/trunk/lib/Sema/SemaInit.cpp

Eli Friedman eli.friedman at gmail.com
Thu Apr 16 10:49:48 PDT 2009


Author: efriedma
Date: Thu Apr 16 12:49:48 2009
New Revision: 69298

URL: http://llvm.org/viewvc/llvm-project?rev=69298&view=rev
Log:
Attempt to fix a read-after-free running test/Sema/designated-initializers.c.

Douglas, can you check that this is doing the right thing?


Modified:
    cfe/trunk/lib/Sema/SemaInit.cpp

Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=69298&r1=69297&r2=69298&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Thu Apr 16 12:49:48 2009
@@ -1234,15 +1234,15 @@
         ExpandAnonymousFieldDesignator(SemaRef, DIE, DesigIdx, 
                                        cast<FieldDecl>(*Lookup.first),
                                        Field, FieldIndex);
+        D = DIE->getDesignator(DesigIdx);
       } else {
         // Name lookup found something, but it wasn't a field.
         SemaRef.Diag(D->getFieldLoc(), diag::err_field_designator_nonfield)
           << FieldName;
         SemaRef.Diag((*Lookup.first)->getLocation(), 
                       diag::note_field_designator_found);
-
-      ++Index;
-      return true;
+        ++Index;
+        return true;
       }
     } else if (!KnownField &&
                cast<RecordDecl>((*Field)->getDeclContext())





More information about the cfe-commits mailing list