https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79756

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jsm28 at gcc dot gnu.org,
                   |                            |rguenth at gcc dot gnu.org

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
We run into convert_vector_to_array_for_subscript /
c_common_mark_addressable_vec with

<<< Unknown tree: c_maybe_const_expr

  <<< Unknown tree: compound_literal_expr
    V D.1797 = {1, 0}; >>> >>>

not sure if that's intended.  But due to this we fail to mark the vector
as addressable which then results in this ICE.

Fix:

Index: gcc/c-family/c-common.c
===================================================================
--- gcc/c-family/c-common.c     (revision 245780)
+++ gcc/c-family/c-common.c     (working copy)
@@ -6534,6 +6534,8 @@ complete_array_type (tree *ptype, tree i
 void 
 c_common_mark_addressable_vec (tree t)
 {   
+  if (TREE_CODE (t) == C_MAYBE_CONST_EXPR)
+    t = C_MAYBE_CONST_EXPR_EXPR (t);
   while (handled_component_p (t))
     t = TREE_OPERAND (t, 0);
   if (!VAR_P (t)

but note that convert_vector_to_array_for_subscript will return
VIEW_CONVERT_EXPR <array-type> (MAYBE_CONST (...)) then.  Maybe proper
operation is to instead return

MAYBE_CONST (VIEW_CONVERT_EXPR <array-type> (...))?

Or the caller (build_array_ref) was supposed to strip MAYBE_CONST and
put it back around the array-ref?

I don't understand the C_MAYBE_CONST stuff very well so leaving the actual
fix to C FE maintainers.

Reply via email to