aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/ExprConstant.cpp
diff options
context:
space:
mode:
authorJoey Gouly <joey.gouly@arm.com>2013-01-29 15:09:40 +0000
committerJoey Gouly <joey.gouly@arm.com>2013-01-29 15:09:40 +0000
commita52d278f0fbac83fa26a03948759cce467d8e55b (patch)
tree2d2ebaa71c4fe49b90e77a8f045c14f8bbcd9ba6 /lib/AST/ExprConstant.cpp
parentadc6aba07293928122629e9d8a91a37144254831 (diff)
Fix a crash in OpenCL code by using the proper (RHS) bit-width.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173802 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ExprConstant.cpp')
-rw-r--r--lib/AST/ExprConstant.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp
index 4ea6399a48..ae86150ee2 100644
--- a/lib/AST/ExprConstant.cpp
+++ b/lib/AST/ExprConstant.cpp
@@ -4723,7 +4723,7 @@ bool DataRecursiveIntBinOpEvaluator::
case BO_Shl: {
if (Info.getLangOpts().OpenCL)
// OpenCL 6.3j: shift values are effectively % word size of LHS.
- RHS &= APSInt(llvm::APInt(LHS.getBitWidth(),
+ RHS &= APSInt(llvm::APInt(RHS.getBitWidth(),
static_cast<uint64_t>(LHS.getBitWidth() - 1)),
RHS.isUnsigned());
else if (RHS.isSigned() && RHS.isNegative()) {
@@ -4755,7 +4755,7 @@ bool DataRecursiveIntBinOpEvaluator::
case BO_Shr: {
if (Info.getLangOpts().OpenCL)
// OpenCL 6.3j: shift values are effectively % word size of LHS.
- RHS &= APSInt(llvm::APInt(LHS.getBitWidth(),
+ RHS &= APSInt(llvm::APInt(RHS.getBitWidth(),
static_cast<uint64_t>(LHS.getBitWidth() - 1)),
RHS.isUnsigned());
else if (RHS.isSigned() && RHS.isNegative()) {