From: Richard Biener Date: Thu, 22 Sep 2016 12:15:38 +0000 (+0000) Subject: re PR fortran/77678 (ICE in fold_read_from_constant_string, at fold-const.c:13706) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c813f2686aa230cf20ca954dee94b1019b7c364b;p=gcc.git re PR fortran/77678 (ICE in fold_read_from_constant_string, at fold-const.c:13706) 2016-09-22 Richard Biener PR middle-end/77678 * expr.c (expand_expr_real_1): Guard array access against negative offset. From-SVN: r240351 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 485d80887b8..9b1792596fc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-09-22 Richard Biener + + PR middle-end/77678 + * expr.c (expand_expr_real_1): Guard array access against negative + offset. + 2016-09-22 Rainer Orth * gimple-ssa-sprintf.c (format_floating_max): Use GMP_RNDN instead diff --git a/gcc/expr.c b/gcc/expr.c index 73e000efca6..2e97030c5b8 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -10274,7 +10274,8 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode, fold_convert_loc (loc, sizetype, low_bound)); - if (compare_tree_int (index1, TREE_STRING_LENGTH (init)) < 0) + if (tree_fits_uhwi_p (index1) + && compare_tree_int (index1, TREE_STRING_LENGTH (init)) < 0) { tree type = TREE_TYPE (TREE_TYPE (init)); machine_mode mode = TYPE_MODE (type);