Index: gcc/c-family/c-common.c =================================================================== --- gcc/c-family/c-common.c (revision 248308) +++ gcc/c-family/c-common.c (working copy) @@ -3106,24 +3106,24 @@ pointer_int_sum (location_t loc, enum tr because weird cases involving pointer arithmetic can result in a sum or difference with different type args. */ ptrop = build_binary_op (EXPR_LOCATION (TREE_OPERAND (intop, 1)), subcode, ptrop, convert (int_type, TREE_OPERAND (intop, 1)), 1); intop = convert (int_type, TREE_OPERAND (intop, 0)); } /* Convert the integer argument to a type the same size as sizetype so the multiply won't overflow spuriously. */ - if (TYPE_PRECISION (TREE_TYPE (intop)) != TYPE_PRECISION (sizetype) - || TYPE_UNSIGNED (TREE_TYPE (intop)) != TYPE_UNSIGNED (sizetype)) - intop = convert (c_common_type_for_size (TYPE_PRECISION (sizetype), - TYPE_UNSIGNED (sizetype)), intop); + if (TYPE_PRECISION (TREE_TYPE (intop)) != TYPE_PRECISION (ssizetype) + || TYPE_UNSIGNED (TREE_TYPE (intop)) != TYPE_UNSIGNED (ssizetype)) + intop = convert (c_common_type_for_size (TYPE_PRECISION (ssizetype), + TYPE_UNSIGNED (ssizetype)), intop); /* Replace the integer argument with a suitable product by the object size. Do this multiplication as signed, then convert to the appropriate type for the pointer operation and disregard an overflow that occurred only because of the sign-extension change in the latter conversion. */ { tree t = fold_build2_loc (loc, MULT_EXPR, TREE_TYPE (intop), intop, convert (TREE_TYPE (intop), size_exp)); intop = convert (sizetype, t); if (TREE_OVERFLOW_P (intop) && !TREE_OVERFLOW (t))