mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 04:38:24 +00:00
Define a maximum supported alignment value for load, store, and
alloca instructions (constrained by their internal encoding), and add error checking for it. Fix an instcombine bug which generated huge alignment values (null is infinitely aligned). This fixes undefined behavior noticed by John Regehr. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109643 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -1154,6 +1154,8 @@ bool LLParser::ParseOptionalAlignment(unsigned &Alignment) {
|
||||
if (ParseUInt32(Alignment)) return true;
|
||||
if (!isPowerOf2_32(Alignment))
|
||||
return Error(AlignLoc, "alignment is not a power of two");
|
||||
if (Alignment > MaximumAlignment)
|
||||
return Error(AlignLoc, "huge alignments are not supported yet");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1176,6 +1178,7 @@ bool LLParser::ParseOptionalCommaAlign(unsigned &Alignment,
|
||||
if (Lex.getKind() != lltok::kw_align)
|
||||
return Error(Lex.getLoc(), "expected metadata or 'align'");
|
||||
|
||||
LocTy AlignLoc = Lex.getLoc();
|
||||
if (ParseOptionalAlignment(Alignment)) return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user