Hi!

CONSTRUCTOR indices for arrays have bitsize type, and the r15-4375
patch actually got it right in 6 other spots, but not in this function,
where it used size_int rather than bitsize_int and so size_binop can ICE
on type mismatch.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
ok for trunk?

This is covered by the init-5.c testcase I've just posted, though the ICE
goes away when the C FE is fixed (and when it is not, there is another
ICE).

2024-10-22  Jakub Jelinek  <ja...@redhat.com>

        PR c/117190
        * varasm.c (array_size_for_constructor): For RAW_DATA_CST,
        use bitsize_int rather than size_int.

--- gcc/varasm.cc.jj    2024-10-16 20:35:19.108756469 +0200
+++ gcc/varasm.cc       2024-10-17 22:27:37.048983429 +0200
@@ -5488,7 +5488,7 @@ array_size_for_constructor (tree val)
        index = TREE_OPERAND (index, 1);
       if (value && TREE_CODE (value) == RAW_DATA_CST)
        index = size_binop (PLUS_EXPR, index,
-                           size_int (RAW_DATA_LENGTH (value) - 1));
+                           bitsize_int (RAW_DATA_LENGTH (value) - 1));
       if (max_index == NULL_TREE || tree_int_cst_lt (max_index, index))
        max_index = index;
     }

        Jakub

Reply via email to