loc_list_for_tree_1 and add_const_value_attribute currently ICE
on POLY_INTs.  loc_list_for_tree_1 can do something sensible but
add_const_value_attribute has to punt, since the constant there
needs to be a link-time rather than load-time or run-time constant.

This is tested by later SVE patches.

Tested on aarch64-linux-gnu with SVE (with and without follow-on
patches) and x86_64-linux-gnu.  OK to install?

Richard


2019-09-18  Richard Sandiford  <richard.sandif...@arm.com>

gcc/
        * dwarf2out.c (loc_list_from_tree_1): Handle POLY_INT_CST.
        (add_const_value_attribute): Handle CONST_POLY_INT.

Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c     2019-09-17 15:27:11.374066662 +0100
+++ gcc/dwarf2out.c     2019-09-18 07:47:42.297132785 +0100
@@ -18568,6 +18568,24 @@ loc_list_from_tree_1 (tree loc, int want
        }
       break;
 
+    case POLY_INT_CST:
+      {
+       if (want_address)
+         {
+           expansion_failed (loc, NULL_RTX,
+                             "constant address with a runtime component");
+           return 0;
+         }
+       poly_int64 value;
+       if (!poly_int_tree_p (loc, &value))
+         {
+           expansion_failed (loc, NULL_RTX, "constant too big");
+           return 0;
+         }
+       ret = int_loc_descriptor (value);
+      }
+      break;
+
     case CONSTRUCTOR:
     case REAL_CST:
     case STRING_CST:
@@ -19684,6 +19702,7 @@ add_const_value_attribute (dw_die_ref di
     case MINUS:
     case SIGN_EXTEND:
     case ZERO_EXTEND:
+    case CONST_POLY_INT:
       return false;
 
     case MEM:

Reply via email to