Do not crash when performing VisitLValue on union types.
This fixes PR 2948. llvm-svn: 58148
This commit is contained in:
parent
f856f50463
commit
e69a1fa342
|
|
@ -457,9 +457,10 @@ void GRExprEngine::VisitLValue(Expr* Ex, NodeTy* Pred, NodeSet& Dst) {
|
||||||
// can be used in a lvalue context. We need to enhance our support
|
// can be used in a lvalue context. We need to enhance our support
|
||||||
// of such temporaries in both the environment and the store, so right
|
// of such temporaries in both the environment and the store, so right
|
||||||
// now we just do a regular visit.
|
// now we just do a regular visit.
|
||||||
assert (Ex->getType()->isAggregateType() &&
|
assert ((Ex->getType()->isAggregateType() ||
|
||||||
"Other kinds of expressions with non-aggregate types do not "
|
Ex->getType()->isUnionType()) &&
|
||||||
"have lvalues.");
|
"Other kinds of expressions with non-aggregate/union types do"
|
||||||
|
" not have lvalues.");
|
||||||
|
|
||||||
Visit(Ex, Pred, Dst);
|
Visit(Ex, Pred, Dst);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,3 +43,16 @@ void divzeroassumeB(unsigned x, unsigned j) {
|
||||||
if (j == 0) x = x / 0; // no-warning
|
if (j == 0) x = x / 0; // no-warning
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PR 2948 (testcase; crash on VisitLValue for union types)
|
||||||
|
// http://llvm.org/bugs/show_bug.cgi?id=2948
|
||||||
|
|
||||||
|
void checkaccess_union() {
|
||||||
|
int ret = 0, status;
|
||||||
|
if (((((__extension__ (((union {
|
||||||
|
__typeof (status) __in; int __i;}
|
||||||
|
)
|
||||||
|
{
|
||||||
|
.__in = (status)}
|
||||||
|
).__i))) & 0xff00) >> 8) == 1)
|
||||||
|
ret = 1;
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue