OSDN Git Service

[RISCV] Avoid overflow when determining number of nops for code align
authorAlex Bradbury <asb@lowrisc.org>
Tue, 16 Jul 2019 04:40:25 +0000 (04:40 +0000)
committerAlex Bradbury <asb@lowrisc.org>
Tue, 16 Jul 2019 04:40:25 +0000 (04:40 +0000)
commitc052b6489a258faf29a8654fa207501e3304a71c
tree93007aaad51b97b654fc3f7bba638e9979bc2463
parenta72781d6bd0df2677662cb9c6d466907dbb5dd53
[RISCV] Avoid overflow when determining number of nops for code align

RISCVAsmBackend::shouldInsertExtraNopBytesForCodeAlign() assumed that the
align specified would be greater than or equal to the minimum nop length, but
that is not always the case - for example if a user specifies ".align 0" in
assembly.

Differential Revision: https://reviews.llvm.org/D63274
Patch by Edward Jones.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366176 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
test/MC/RISCV/align.s