summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Attributes.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2017-05-19 22:23:47 +0000
committerReid Kleckner <rnk@google.com>2017-05-19 22:23:47 +0000
commitbf6b3b1564f1846c5c729b582b4bc3f97d946770 (patch)
treebe89cb95ed883c6a0f284d28a9624af2d5d8e66f /llvm/lib/IR/Attributes.cpp
parent78706a3daebcac93517b1560a1092828b3505ea5 (diff)
downloadbcm5719-llvm-bf6b3b1564f1846c5c729b582b4bc3f97d946770.tar.gz
bcm5719-llvm-bf6b3b1564f1846c5c729b582b4bc3f97d946770.zip
Fix off-by-one bug in AttributeList::addAttributes index handling
getParamAlignment expects an argument number, not an AttributeList index. Johan Englan, who works on LDC, found this bug and told me about it off list. llvm-svn: 303458
Diffstat (limited to 'llvm/lib/IR/Attributes.cpp')
-rw-r--r--llvm/lib/IR/Attributes.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp
index ce60367a6c8..adb31d127a2 100644
--- a/llvm/lib/IR/Attributes.cpp
+++ b/llvm/lib/IR/Attributes.cpp
@@ -1058,7 +1058,7 @@ AttributeList AttributeList::addAttributes(LLVMContext &C, unsigned Index,
#ifndef NDEBUG
// FIXME it is not obvious how this should work for alignment. For now, say
// we can't change a known alignment.
- unsigned OldAlign = getParamAlignment(Index);
+ unsigned OldAlign = getAttributes(Index).getAlignment();
unsigned NewAlign = B.getAlignment();
assert((!OldAlign || !NewAlign || OldAlign == NewAlign) &&
"Attempt to change alignment!");
OpenPOWER on IntegriCloud