diff --git a/gcc/stor-layout.cc b/gcc/stor-layout.cc index 4cf249133e9..31da2c123ab 100644 --- a/gcc/stor-layout.cc +++ b/gcc/stor-layout.cc @@ -2427,8 +2427,16 @@ layout_type (tree type) } else { - SET_TYPE_MODE (type, BLKmode); cnt = CEIL (TYPE_PRECISION (type), GET_MODE_PRECISION (limb_mode)); + machine_mode mode; + /* Some targets use TARGET_ARRAY_MODE to select the mode they use + for arrays with a specific element mode and a specific element + count and we should use this mode for large bitints that are + stored as such arrays. */ + if (!targetm.array_mode (limb_mode, cnt).exists (&mode) + || !targetm.array_mode_supported_p (limb_mode, cnt)) + mode = BLKmode; + SET_TYPE_MODE (type, mode); gcc_assert (info.abi_limb_mode == info.limb_mode || !info.big_endian == !WORDS_BIG_ENDIAN); }