[LLVMbugs] [Bug 7748] New: VC++ truncates X86II::VEX enum constants
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Jul 29 07:46:55 PDT 2010
http://llvm.org/bugs/show_bug.cgi?id=7748
Summary: VC++ truncates X86II::VEX enum constants
Product: new-bugs
Version: trunk
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: normal
Priority: P
Component: new bugs
AssignedTo: unassignedbugs at nondot.org
ReportedBy: dimitry at andric.com
CC: llvmbugs at cs.uiuc.edu
During compilation with VC++ 9 of several llvm files that include
X86InstInfo.h, I am getting the following warnings about it:
lib\target\x86\X86InstrInfo.h(442) : warning C4341: 'VEX' : signed value is out
of range for enum constant
lib\target\x86\X86InstrInfo.h(442) : warning C4309: 'initializing' : truncation
of constant value
lib\target\x86\X86InstrInfo.h(446) : warning C4341: 'VEX_W' : signed value is
out of range for enum constant
lib\target\x86\X86InstrInfo.h(446) : warning C4309: 'initializing' : truncation
of constant value
lib\target\x86\X86InstrInfo.h(451) : warning C4341: 'VEX_4V' : signed value is
out of range for enum constant
lib\target\x86\X86InstrInfo.h(451) : warning C4309: 'initializing' : truncation
of constant value
lib\target\x86\X86InstrInfo.h(456) : warning C4341: 'VEX_I8IMM' : signed value
is out of range for enum constant
lib\target\x86\X86InstrInfo.h(456) : warning C4309: 'initializing' : truncation
of constant value
lib\target\x86\X86InstrInfo.h(463) : warning C4341: 'VEX_L' : signed value is
out of range for enum constant
lib\target\x86\X86InstrInfo.h(463) : warning C4309: 'initializing' : truncation
of constant value
This is because of the following enum constants in the X86II namespace:
// VEX - The opcode prefix used by AVX instructions
VEX = 1ULL << 32,
// VEX_W - Has a opcode specific functionality, but is used in the same
// way as REX_W is for regular SSE instructions.
VEX_W = 1ULL << 33,
// VEX_4V - Used to specify an additional AVX/SSE register. Several 2
// address instructions in SSE are represented as 3 address ones in AVX
// and the additional register is encoded in VEX_VVVV prefix.
VEX_4V = 1ULL << 34,
// VEX_I8IMM - Specifies that the last register used in a AVX instruction,
// must be encoded in the i8 immediate field. This usually happens in
// instructions with 4 operands.
VEX_I8IMM = 1ULL << 35,
// VEX_L - Stands for a bit in the VEX opcode prefix meaning the current
// instruction uses 256-bit wide registers. This is usually auto detected
if
// a VR256 register is used, but some AVX instructions also have this field
// marked when using a f256 memory references.
VEX_L = 1ULL << 36
So unfortunately VC++ truncates these constants, which is probably very
bad if you count on those exact values. The MSDN library says the
following about this warning:
"An enumerated constant exceeds the limit for an int. The value of the
invalid constant is undefined. Constants must resolve to integers
between –4,294,967,295 and +4,294,967,295 (signed)."
http://msdn.microsoft.com/en-us/library/x651y302.aspx
Therefore, these constants should probably be replaced by globals, or
maybe even #defines... (yuck :)
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list