[llvm-commits] [llvm] r61675 - /llvm/trunk/lib/AsmParser/LLParser.cpp
Chris Lattner
sabre at nondot.org
Sun Jan 4 23:46:05 PST 2009
Author: lattner
Date: Mon Jan 5 01:46:05 2009
New Revision: 61675
URL: http://llvm.org/viewvc/llvm-project?rev=61675&view=rev
Log:
PR3281:crash00.ll: produce this diagnostic instead of crashing:
@t = global i8 0, align 3
^
Modified:
llvm/trunk/lib/AsmParser/LLParser.cpp
Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=61675&r1=61674&r2=61675&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Mon Jan 5 01:46:05 2009
@@ -793,7 +793,11 @@
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
More information about the llvm-commits
mailing list