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

Douglas Gregor dgregor at apple.com
Sun Apr 29 18:08:59 PDT 2012


Approved!

Sent from my iPhone

On Apr 29, 2012, at 5:45 PM, Richard Smith <richard at metafoo.co.uk> wrote:

> Requesting a port to the branch: this was breaking bootstrap from recent versions of gcc.
> 
> On Sun, Apr 29, 2012 at 5:16 PM, Richard Smith <richard-llvm at metafoo.co.uk> wrote:
> 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;
> 
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120429/167b4737/attachment.html>


More information about the cfe-commits mailing list