diff options
author | NAKAMURA Takumi <geek4civic@gmail.com> | 2012-12-26 06:43:14 +0000 |
---|---|---|
committer | NAKAMURA Takumi <geek4civic@gmail.com> | 2012-12-26 06:43:14 +0000 |
commit | bf99a426cb311cd7b1cebb63f28a8e4762fcee4c (patch) | |
tree | 68e8d0b1d301dcb8eec86d06cd09a99960639e10 /llvm/utils/TableGen/FixedLenDecoderEmitter.cpp | |
parent | 794a73124bd4f831d6c7e235f4630bb094108e7c (diff) | |
download | bcm5719-llvm-bf99a426cb311cd7b1cebb63f28a8e4762fcee4c.tar.gz bcm5719-llvm-bf99a426cb311cd7b1cebb63f28a8e4762fcee4c.zip |
TableGen/FixedLenDecoderEmitter.cpp: Fix a potential mask overflow in fieldFromInstruction().
Reported by Yang Yongyong, thanks!
llvm-svn: 171101
Diffstat (limited to 'llvm/utils/TableGen/FixedLenDecoderEmitter.cpp')
-rw-r--r-- | llvm/utils/TableGen/FixedLenDecoderEmitter.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp b/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp index b2dc8788809..0c3017f3892 100644 --- a/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp +++ b/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp @@ -1866,7 +1866,7 @@ static void emitFieldFromInstruction(formatted_raw_ostream &OS) { << " if (numBits == sizeof(InsnType)*8)\n" << " fieldMask = (InsnType)(-1LL);\n" << " else\n" - << " fieldMask = ((1 << numBits) - 1) << startBit;\n" + << " fieldMask = (((InsnType)1 << numBits) - 1) << startBit;\n" << " return (insn & fieldMask) >> startBit;\n" << "}\n\n"; } |