PR debug/66728
authormrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 6 Nov 2015 20:16:06 +0000 (20:16 +0000)
committermrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 6 Nov 2015 20:16:06 +0000 (20:16 +0000)
* dwarf2out.c (get_full_len): Return a value based upon the actual
precision needed for the value.
(add_const_value_attribute): Use a maximal wide-int for
CONST_WIDE_INTs, not VOIDmode.
(output_die): Don't ever output NULL with printf.

* rtl.h (get_precision of rtx_mode_t): Ensure we never process
BLKmode nor VOIDmode values.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229885 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/dwarf2out.c
gcc/rtl.h

index 7b92236..6756e35 100644 (file)
@@ -1,3 +1,15 @@
+2015-11-06  Mike Stump  <mikestump@comcast.net>
+
+       PR debug/66728
+       * dwarf2out.c (get_full_len): Return a value based upon the actual
+       precision needed for the value.
+       (add_const_value_attribute): Use a maximal wide-int for
+       CONST_WIDE_INTs, not VOIDmode.
+       (output_die): Don't ever output NULL with printf.
+
+       * rtl.h (get_precision of rtx_mode_t): Ensure we never process
+       BLKmode nor VOIDmode values.
+
 2015-11-06  David Malcolm  <dmalcolm@redhat.com>
 
        * diagnostic-color.c (color_dict): Eliminate "caret"; add "range1"
index 9ce3f09..48c2208 100644 (file)
@@ -368,12 +368,14 @@ dump_struct_debug (tree type, enum debug_info_usage usage,
 #endif
 
 /* Get the number of HOST_WIDE_INTs needed to represent the precision
-   of the number.  */
+   of the number.  Some constants have a large uniform precision, so
+   we get the precision needed for the actual value of the number.  */
 
 static unsigned int
 get_full_len (const wide_int &op)
 {
-  return ((op.get_precision () + HOST_BITS_PER_WIDE_INT - 1)
+  int prec = wi::min_precision (op, UNSIGNED);
+  return ((prec + HOST_BITS_PER_WIDE_INT - 1)
          / HOST_BITS_PER_WIDE_INT);
 }
 
@@ -9010,14 +9012,14 @@ output_die (dw_die_ref die)
                {
                  dw2_asm_output_data (l, a->dw_attr_val.v.val_wide->elt (i),
                                       "%s", name);
-                 name = NULL;
+                 name = "";
                }
            else
              for (i = 0; i < len; ++i)
                {
                  dw2_asm_output_data (l, a->dw_attr_val.v.val_wide->elt (i),
                                       "%s", name);
-                 name = NULL;
+                 name = "";
                }
          }
          break;
@@ -15593,8 +15595,13 @@ add_const_value_attribute (dw_die_ref die, rtx rtl)
       return true;
 
     case CONST_WIDE_INT:
-      add_AT_wide (die, DW_AT_const_value,
-                  std::make_pair (rtl, GET_MODE (rtl)));
+      {
+       wide_int w1 = std::make_pair (rtl, MAX_MODE_INT);
+       unsigned int prec = MIN (wi::min_precision (w1, UNSIGNED),
+                                (unsigned int)CONST_WIDE_INT_NUNITS (rtl) * HOST_BITS_PER_WIDE_INT);
+       wide_int w = wi::zext (w1, prec);
+       add_AT_wide (die, DW_AT_const_value, w);
+      }
       return true;
 
     case CONST_DOUBLE:
index fe081ed..194ed9b 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2086,6 +2086,7 @@ namespace wi
 inline unsigned int
 wi::int_traits <rtx_mode_t>::get_precision (const rtx_mode_t &x)
 {
+  gcc_checking_assert (x.second != BLKmode && x.second != VOIDmode);
   return GET_MODE_PRECISION (x.second);
 }