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


This fixes PR77697, an ice-on-invalid for Fortran (varasm later errors).

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

Richard.

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

	PR middle-end/77697
	* gimple-fold.c (fold_array_ctor_reference): Turn asserts into
	fold fails.

Index: gcc/gimple-fold.c
===================================================================
--- gcc/gimple-fold.c	(revision 240342)
+++ gcc/gimple-fold.c	(working copy)
@@ -5647,14 +5638,15 @@ fold_array_ctor_reference (tree type, tr
   if (domain_type && TYPE_MIN_VALUE (domain_type))
     {
       /* Static constructors for variably sized objects makes no sense.  */
-      gcc_assert (TREE_CODE (TYPE_MIN_VALUE (domain_type)) == INTEGER_CST);
+      if (TREE_CODE (TYPE_MIN_VALUE (domain_type)) != INTEGER_CST)
+	return NULL_TREE;
       low_bound = wi::to_offset (TYPE_MIN_VALUE (domain_type));
     }
   else
     low_bound = 0;
   /* Static constructors for variably sized objects makes no sense.  */
-  gcc_assert (TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (ctor))))
-	      == INTEGER_CST);
+  if (TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (ctor)))) != INTEGER_CST)
+    return NULL_TREE;
   elt_size = wi::to_offset (TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (ctor))));
 
   /* We can handle only constantly sized accesses that are known to not

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] Fix PR77697
@ 2016-09-23 12:48 Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2016-09-23 12:48 UTC (permalink / raw)
  To: gcc-patches


As noted in the PR defcodefor_name was quite broken - the following
rectifies it.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

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

	PR tree-optimization/77697
	* tree-ssa-forwprop.c (defcodefor_name): Remove bogus code,
	signal error if we have sth ternary or unhandled.

Index: gcc/tree-ssa-forwprop.c
===================================================================
--- gcc/tree-ssa-forwprop.c	(revision 240388)
+++ gcc/tree-ssa-forwprop.c	(working copy)
@@ -1458,6 +1458,7 @@ defcodefor_name (tree name, enum tree_co
   code1 = TREE_CODE (name);
   arg11 = name;
   arg21 = NULL_TREE;
+  arg31 = NULL_TREE;
   grhs_class = get_gimple_rhs_class (code1);
 
   if (code1 == SSA_NAME)
@@ -1470,20 +1471,18 @@ defcodefor_name (tree name, enum tree_co
 	  code1 = gimple_assign_rhs_code (def);
 	  arg11 = gimple_assign_rhs1 (def);
           arg21 = gimple_assign_rhs2 (def);
-          arg31 = gimple_assign_rhs2 (def);
+          arg31 = gimple_assign_rhs3 (def);
 	}
     }
-  else if (grhs_class == GIMPLE_TERNARY_RHS
-	   || GIMPLE_BINARY_RHS
-	   || GIMPLE_UNARY_RHS
-	   || GIMPLE_SINGLE_RHS)
-    extract_ops_from_tree (name, &code1, &arg11, &arg21, &arg31);
+  else if (grhs_class != GIMPLE_SINGLE_RHS)
+    code1 = ERROR_MARK;
 
   *code = code1;
   *arg1 = arg11;
   if (arg2)
     *arg2 = arg21;
-  /* Ignore arg3 currently. */
+  if (arg31)
+    *code = ERROR_MARK;
 }
 
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-23 12:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-22 12:49 [PATCH] Fix PR77697 Richard Biener
2016-09-23 12:48 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).