This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/77678] ICE in fold_read_from_constant_string, at fold-const.c:13706
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 22 Sep 2016 08:28:47 +0000
- Subject: [Bug fortran/77678] ICE in fold_read_from_constant_string, at fold-const.c:13706
- Auto-submitted: auto-generated
- References: <bug-77678-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77678
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |accepts-invalid
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
I have a patch for the ICE.
Index: gcc/expr.c
===================================================================
--- gcc/expr.c (revision 240342)
+++ gcc/expr.c (working copy)
@@ -10274,7 +10257,8 @@ expand_expr_real_1 (tree exp, rtx target
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);