Skip to content
This repository has been archived by the owner on Apr 23, 2020. It is now read-only.

Commit

Permalink
PR11926 + duplicates: Fix crash in -Wuninitialized when using a compi…
Browse files Browse the repository at this point in the history
…ler 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155803 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
zygoloid committed Apr 30, 2012
1 parent 6850faf commit b86b855
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/Analysis/UninitializedValues.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ static const BinaryOperator *getLogicalOperatorInChain(const CFGBlock *block) {
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;

Expand Down

0 comments on commit b86b855

Please sign in to comment.