[cfe-commits] r39618 - /cfe/cfe/trunk/AST/Expr.cpp
clattner at cs.uiuc.edu
clattner at cs.uiuc.edu
Wed Jul 11 09:46:18 PDT 2007
Author: clattner
Date: Wed Jul 11 11:46:18 2007
New Revision: 39618
URL: http://llvm.org/viewvc/llvm-project?rev=39618&view=rev
Log:
fix assertion on out-of-range shift
Modified:
cfe/cfe/trunk/AST/Expr.cpp
Modified: cfe/cfe/trunk/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/Expr.cpp?rev=39618&r1=39617&r2=39618&view=diff
==============================================================================
--- cfe/cfe/trunk/AST/Expr.cpp (original)
+++ cfe/cfe/trunk/AST/Expr.cpp Wed Jul 11 11:46:18 2007
@@ -346,8 +346,12 @@
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;
More information about the cfe-commits
mailing list