public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix PR77678
@ 2016-09-22 12:13 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2016-09-22 12:13 UTC (permalink / raw)
  To: gcc-patches


This fixes an ice-on-invalid for fortran.

Bootstrapped/tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2016-09-22  Richard Biener  <rguenther@suse.de>

	PR middle-end/77678
	* expr.c (expand_expr_real_1): Guard array access against negative
	offset.

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);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-09-22 12:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-22 12:13 [PATCH] Fix PR77678 Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).