[LLVMbugs] [Bug 19712] New: Enumeration constants emitted with the wrong sign/extension
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sun May 11 09:48:57 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=19712
Bug ID: 19712
Summary: Enumeration constants emitted with the wrong
sign/extension
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: DebugInfo
Assignee: unassignedbugs at nondot.org
Reporter: dblaikie at gmail.com
CC: aprantl at apple.com, echristo at gmail.com,
llvmbugs at cs.uiuc.edu
Classification: Unclassified
When emitting a debug info constant (DwarfUnit::addConstantValue) we interpret
the 64 bits of immediate as signed or unsigned based on the type.
We don't emit the underlying type of an enum, so we just assume the type is one
way or the other (DwarfUnit.cpp:isUnsignedDIType - we assume that the type is
signed).
This means we get this wrong:
enum x { y = 4294967295U };
x z;
By describing the constant as -1 (assuming the 64 bit constant was signed)
0x0000003b: DW_TAG_enumerator [4]
DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000002e] = "y")
DW_AT_const_value [DW_FORM_sdata] (-1)
FWIW: GCC always produces sdata constants by the looks of it, but it gets it
right by producing a larger constant, rather than using a possibly smaller
udata (even if the enum's underlying type is an unsigned type) value.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140511/6ca45a6a/attachment.html>
More information about the llvm-bugs
mailing list