aboutsummaryrefslogtreecommitdiffstats
path: root/lib/AsmParser
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
commit3fbb3ab14d86f752a933b5af4e6728c5e57e1155 (patch)
treeb32df6dcb5f3726e47c12f91d8884a9938ef122b /lib/AsmParser
parent69f9378675b23135043d93aa58300fed3ec41cbf (diff)
downloadexternal_llvm-3fbb3ab14d86f752a933b5af4e6728c5e57e1155.zip
external_llvm-3fbb3ab14d86f752a933b5af4e6728c5e57e1155.tar.gz
external_llvm-3fbb3ab14d86f752a933b5af4e6728c5e57e1155.tar.bz2
PR3281:crash00.ll: produce this diagnostic instead of crashing:
@t = global i8 0, align 3 ^ git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61675 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AsmParser')
-rw-r--r--lib/AsmParser/LLParser.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp
index e44e650..1f08ca3 100644
--- a/lib/AsmParser/LLParser.cpp
+++ b/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