This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR 30140, inliner produces invalid gimple

  In some cases the inliner can produce invalid gimple.  It produces
non_gimple_var = (char) int_gimple_var;
This happens when we have a promoted argument and the argument has its
address taken.  This patch fixes the problem by using saying we want to
gimplify the statement if the variable is not a gimple register.

This is the first in a series of patches for invalid gimple produced by
the difference passes.  We don't have a check for this invalid gimple
right now but I have a patch to add it.  The reason why I have not
submitted it yet because of there are passes which produces invalid

OK? Bootstrapped and tested on i686-linux-gnu with no regressions.

Andrew Pinski


	* tree-inline.c (setup_one_parameter): Gimplify the statement if
	the variable is not a gimple register variable.
Index: tree-inline.c
--- tree-inline.c	(revision 119876)
+++ tree-inline.c	(working copy)
@@ -1106,9 +1106,10 @@ setup_one_parameter (copy_body_data *id,
 	 at the end.  Note that is_gimple_cast only checks the outer
 	 tree code, not its operand.  Thus the explicit check that its
 	 operand is a gimple value.  */
-      if (!is_gimple_val (rhs)
+      if ((!is_gimple_val (rhs)
 	  && (!is_gimple_cast (rhs)
 	      || !is_gimple_val (TREE_OPERAND (rhs, 0))))
+	  || !is_gimple_reg (var))
 	gimplify_stmt (&init_stmt);
       /* If VAR represents a zero-sized variable, it's possible that the

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]