summaryrefslogtreecommitdiff
path: root/gcc/dwarf2out.c
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2004-03-01 04:07:36 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2004-03-01 04:07:36 +0000
commit99f3dd6a02b9049853176aacfd11b67c61e2b6f3 (patch)
tree0dc664d7c48ac7ac3e537bacd71c16fdf9d499e5 /gcc/dwarf2out.c
parent16bd3ffed031d062b8fa0366e16f7e610f7767fb (diff)
downloadgcc-99f3dd6a02b9049853176aacfd11b67c61e2b6f3.tar.gz
PR debug/14328
* dwarf2out.c (gen_enumeration_type_die): Output all enumeration constants as signed values. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@78690 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r--gcc/dwarf2out.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 841827ba597..599b6c9c643 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -10691,20 +10691,20 @@ gen_enumeration_type_die (tree type, dw_die_ref context_die)
link != NULL; link = TREE_CHAIN (link))
{
dw_die_ref enum_die = new_die (DW_TAG_enumerator, type_die, link);
+ tree value = TREE_VALUE (link);
add_name_attribute (enum_die,
IDENTIFIER_POINTER (TREE_PURPOSE (link)));
- if (host_integerp (TREE_VALUE (link),
- TREE_UNSIGNED (TREE_TYPE (TREE_VALUE (link)))))
- {
- if (tree_int_cst_sgn (TREE_VALUE (link)) < 0)
- add_AT_int (enum_die, DW_AT_const_value,
- tree_low_cst (TREE_VALUE (link), 0));
- else
- add_AT_unsigned (enum_die, DW_AT_const_value,
- tree_low_cst (TREE_VALUE (link), 1));
- }
+ if (host_integerp (value, TREE_UNSIGNED (TREE_TYPE (value))))
+ /* DWARF2 does not provide a way of indicating whether or
+ not enumeration constants are signed or unsigned. GDB
+ always assumes the values are signed, so we output all
+ values as if they were signed. That means that
+ enumeration constants with very large unsigned values
+ will appear to have negative values in the debugger. */
+ add_AT_int (enum_die, DW_AT_const_value,
+ tree_low_cst (value, tree_int_cst_sgn (value) > 0));
}
}
else