fix assertion on out-of-range shift

llvm-svn: 39618
This commit is contained in:
Chris Lattner 2007-06-08 21:54:26 +00:00
parent 4cd73fd380
commit 901ae1faf2
1 changed files with 6 additions and 2 deletions

View File

@ -346,8 +346,12 @@ bool Expr::isIntegerConstantExpr(APSInt &Result, SourceLocation *Loc,
break;
case BinaryOperator::Add: Result += RHS; break;
case BinaryOperator::Sub: Result -= RHS; break;
case BinaryOperator::Shl: Result <<= RHS.getLimitedValue(); break;
case BinaryOperator::Shr: Result >>= RHS.getLimitedValue(); break;
case BinaryOperator::Shl:
Result <<= RHS.getLimitedValue(Result.getBitWidth()-1);
break;
case BinaryOperator::Shr:
Result >>= RHS.getLimitedValue(Result.getBitWidth()-1);
break;
case BinaryOperator::LT: Result = Result < RHS; break;
case BinaryOperator::GT: Result = Result > RHS; break;
case BinaryOperator::LE: Result = Result <= RHS; break;