From: NAKAMURA Takumi Date: Wed, 26 Dec 2012 06:43:14 +0000 (+0000) Subject: TableGen/FixedLenDecoderEmitter.cpp: Fix a potential mask overflow in fieldFromInstru... X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=fc093def2d892a2ea068d3b9e6d5839c187cc942;p=oota-llvm.git TableGen/FixedLenDecoderEmitter.cpp: Fix a potential mask overflow in fieldFromInstruction(). Reported by Yang Yongyong, thanks! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171101 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/utils/TableGen/FixedLenDecoderEmitter.cpp b/utils/TableGen/FixedLenDecoderEmitter.cpp index b2dc8788809..0c3017f3892 100644 --- a/utils/TableGen/FixedLenDecoderEmitter.cpp +++ b/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"; }