summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-01-05 07:46:05 +0000
committerChris Lattner <sabre@nondot.org>2009-01-05 07:46:05 +0000
commitd11f51473960a8def039b0269939008ed9e2733f (patch)
tree5e2736b4cdcc9945e6d39d1c11251c9dda086f15 /llvm/lib
parentd32ec016ccf04867f1d20d8f7dd0764a77a7fbd9 (diff)
downloadbcm5719-llvm-d11f51473960a8def039b0269939008ed9e2733f.tar.gz
bcm5719-llvm-d11f51473960a8def039b0269939008ed9e2733f.zip
PR3281:crash00.ll: produce this diagnostic instead of crashing:
@t = global i8 0, align 3 ^ llvm-svn: 61675
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/AsmParser/LLParser.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index e44e65057ca..1f08ca34ff1 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -793,7 +793,11 @@ bool LLParser::ParseOptionalAlignment(unsigned &Alignment) {
Alignment = 0;
if (!EatIfPresent(lltok::kw_align))
return false;
- return ParseUInt32(Alignment);
+ LocTy AlignLoc = Lex.getLoc();
+ if (ParseUInt32(Alignment)) return true;
+ if (!isPowerOf2_32(Alignment))
+ return Error(AlignLoc, "alignment is not a power of two");
+ return false;
}
/// ParseOptionalCommaAlignment
OpenPOWER on IntegriCloud