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

Commit b86b855

Browse files
committed
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155803 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 6850faf commit b86b855

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/Analysis/UninitializedValues.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ static const BinaryOperator *getLogicalOperatorInChain(const CFGBlock *block) {
168168
if (block->empty())
169169
return 0;
170170

171-
const CFGStmt *cstmt = block->front().getAs<CFGStmt>();
171+
CFGElement front = block->front();
172+
const CFGStmt *cstmt = front.getAs<CFGStmt>();
172173
if (!cstmt)
173174
return 0;
174175

0 commit comments

Comments
 (0)