OSDN Git Service

PR debug/14328
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 1 Mar 2004 04:07:36 +0000 (04:07 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 1 Mar 2004 04:07:36 +0000 (04:07 +0000)
* 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

gcc/ChangeLog
gcc/dwarf2out.c

index 6d0f8ce..a13eb92 100644 (file)
@@ -1,5 +1,9 @@
 2004-02-29  Mark Mitchell  <mark@codesourcery.com>
 
+       PR debug/14328
+       * dwarf2out.c (gen_enumeration_type_die): Output all enumeration
+       constants as signed values.
+
        PR middle-end/13448
        * c-tree.h (readonly_warning): Rename to ...
        (readonly_error): ... this.
index 841827b..599b6c9 100644 (file)
@@ -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