[llvm-commits] [llvm] r171101 - /llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp
NAKAMURA Takumi
geek4civic at gmail.com
Tue Dec 25 22:43:15 PST 2012
Author: chapuni
Date: Wed Dec 26 00:43:14 2012
New Revision: 171101
URL: http://llvm.org/viewvc/llvm-project?rev=171101&view=rev
Log:
TableGen/FixedLenDecoderEmitter.cpp: Fix a potential mask overflow in fieldFromInstruction().
Reported by Yang Yongyong, thanks!
Modified:
llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp
Modified: llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp?rev=171101&r1=171100&r2=171101&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp Wed Dec 26 00:43:14 2012
@@ -1866,7 +1866,7 @@
<< " 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";
}
More information about the llvm-commits
mailing list