https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82765
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> --- middle-end "fix" Index: gcc/varasm.c =================================================================== --- gcc/varasm.c (revision 254211) +++ gcc/varasm.c (working copy) @@ -2879,7 +2879,7 @@ static void decode_addr_const (tree exp, struct addr_const *value) { tree target = TREE_OPERAND (exp, 0); - int offset = 0; + HOST_WIDE_INT offset = 0; rtx x; while (1) @@ -2893,8 +2893,9 @@ decode_addr_const (tree exp, struct addr else if (TREE_CODE (target) == ARRAY_REF || TREE_CODE (target) == ARRAY_RANGE_REF) { - offset += (tree_to_uhwi (TYPE_SIZE_UNIT (TREE_TYPE (target))) - * tree_to_shwi (TREE_OPERAND (target, 1))); + /* Truncate big offset. */ + offset += (TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (target))) + * TREE_INT_CST_LOW (TREE_OPERAND (target, 1))); target = TREE_OPERAND (target, 0); } else if (TREE_CODE (target) == MEM_REF there's a lot more errors in it though. For example it doesn't handle an array domain low bound != 1 correctly ... but maybe that's not required (well, strictly speaking it probably is but it may be hard to create a testcase that fails).