mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-24 07:35:04 +00:00
Fix left shifts by too large exponents in MCParser
(which happened only on error recovery path). This bug was reported by UBSan. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216915 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ca514a41ea
commit
251da88db8
@ -2601,13 +2601,14 @@ bool AsmParser::parseDirectiveFill() {
|
||||
if (!isUInt<32>(FillExpr) && FillSize > 4)
|
||||
Warning(ExprLoc, "'.fill' directive pattern has been truncated to 32-bits");
|
||||
|
||||
int64_t NonZeroFillSize = FillSize > 4 ? 4 : FillSize;
|
||||
FillExpr &= ~0ULL >> (64 - NonZeroFillSize * 8);
|
||||
|
||||
for (uint64_t i = 0, e = NumValues; i != e; ++i) {
|
||||
getStreamer().EmitIntValue(FillExpr, NonZeroFillSize);
|
||||
if (NonZeroFillSize < FillSize)
|
||||
getStreamer().EmitIntValue(0, FillSize - NonZeroFillSize);
|
||||
if (NumValues > 0) {
|
||||
int64_t NonZeroFillSize = FillSize > 4 ? 4 : FillSize;
|
||||
FillExpr &= ~0ULL >> (64 - NonZeroFillSize * 8);
|
||||
for (uint64_t i = 0, e = NumValues; i != e; ++i) {
|
||||
getStreamer().EmitIntValue(FillExpr, NonZeroFillSize);
|
||||
if (NonZeroFillSize < FillSize)
|
||||
getStreamer().EmitIntValue(0, FillSize - NonZeroFillSize);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user