forked from OSchip/llvm-project
Teach -Wuninitialized about indirect goto. Fixes PR 9071.
llvm-svn: 124394
This commit is contained in:
parent
5fcfb2fe0c
commit
1be4a59a11
|
@ -158,8 +158,8 @@ static BinaryOperator *getLogicalOperatorInChain(const CFGBlock *block) {
|
|||
llvm::BitVector &CFGBlockValues::getBitVector(const CFGBlock *block,
|
||||
const CFGBlock *dstBlock) {
|
||||
unsigned idx = block->getBlockID();
|
||||
if (dstBlock && block->succ_size() == 2 && block->pred_size() == 2) {
|
||||
assert(block->getTerminator());
|
||||
if (dstBlock && block->succ_size() == 2 && block->pred_size() == 2 &&
|
||||
block->getTerminator()) {
|
||||
if (getLogicalOperatorInChain(block)) {
|
||||
if (*block->succ_begin() == dstBlock)
|
||||
return lazyCreate(vals[idx].first);
|
||||
|
|
|
@ -229,3 +229,14 @@ void test35(int x) {
|
|||
^{ y = (x == 0); }();
|
||||
}
|
||||
|
||||
// Test handling of indirect goto.
|
||||
void test36()
|
||||
{
|
||||
void **pc; // expected-warning{{use of uninitialized variable 'pc'}} expected-note{{ add initialization to silence this warning}}
|
||||
void *dummy[] = { &&L1, &&L2 };
|
||||
L1:
|
||||
goto *pc; // expected-note{{variable 'pc' is possibly uninitialized when used here}}
|
||||
L2:
|
||||
goto *pc;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue