diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-04-30 00:16:51 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-04-30 00:16:51 +0000 |
commit | 6a527718238236bff8672e29414f71ee09073e2a (patch) | |
tree | 2a6395eec760771c8c0997b7b64947e6f7bf2d60 /clang/lib | |
parent | da03f3ba6475603d30a4d09f57a7783b9b8237d6 (diff) | |
download | bcm5719-llvm-6a527718238236bff8672e29414f71ee09073e2a.tar.gz bcm5719-llvm-6a527718238236bff8672e29414f71ee09073e2a.zip |
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.
llvm-svn: 155803
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Analysis/UninitializedValues.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Analysis/UninitializedValues.cpp b/clang/lib/Analysis/UninitializedValues.cpp index 6e5da252597..1c7e6b62f83 100644 --- a/clang/lib/Analysis/UninitializedValues.cpp +++ b/clang/lib/Analysis/UninitializedValues.cpp @@ -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; |