[cfe-commits] r155803 - /cfe/trunk/lib/Analysis/UninitializedValues.cpp

Richard Smith richard-llvm at metafoo.co.uk
Sun Apr 29 17:16:51 PDT 2012


Author: rsmith
Date: Sun Apr 29 19:16:51 2012
New Revision: 155803

URL: http://llvm.org/viewvc/llvm-project?rev=155803&view=rev
Log:
PR11926 + duplicates: Fix crash in -Wuninitialized when using a compiler like
g++4.7, which reuses stack space allocated for temporaries. CFGElement::getAs
returns a suitably-cast version of 'this'. Patch by Markus Trippelsdorf!

No test: this code has the same observable behavior as the old code when built
with most compilers, and the tests were already failing when built with a
compiler for which this produced a broken binary.

Modified:
    cfe/trunk/lib/Analysis/UninitializedValues.cpp

Modified: cfe/trunk/lib/Analysis/UninitializedValues.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/UninitializedValues.cpp?rev=155803&r1=155802&r2=155803&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/UninitializedValues.cpp (original)
+++ cfe/trunk/lib/Analysis/UninitializedValues.cpp Sun Apr 29 19:16:51 2012
@@ -168,7 +168,8 @@
   if (block->empty())
     return 0;
 
-  const CFGStmt *cstmt = block->front().getAs<CFGStmt>();
+  CFGElement front = block->front();
+  const CFGStmt *cstmt = front.getAs<CFGStmt>();
   if (!cstmt)
     return 0;
 





More information about the cfe-commits mailing list