This is the mail archive of the gcc-patches@gcc.gnu.org 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]

Re: Pre-inline optimization, version 3


> Hi Honza,
> 
> On Tuesday 16 January 2007 10:59, Jan Hubicka wrote:
> > > Jan Hubicka <jh@suse.cz> writes:
> > > 
> > > > > raised STORAGE_ERROR : stack overflow (or erroneous memory access)
> > > > > make[3]: *** [ada/erroutc.o] Error 1
> > > > > 
> > > > > 
> > > > > Program received signal SIGSEGV, Segmentation fault.
> > > > Hi,
> > > > sorry for delays, I can't get to IA-64 machine right now (since I can't
> > > > get thru firewall), but the attached patch should plug one of obvious
> > > > places where we might leak dead edges like this.  I will test it on
> > > > IA-64 ASAP.
> > > 
> > > For what it's worth, I get a very similar error when doing an Ada
> > > bootstrap on i686-pc-linux-gnu.  Please make sure you add ada to
> > > --enable-languages when you test these big changes.
> > 
> > Thank you for a hint.  Before sending the request I verified that Ada
> > bootstrap works for me on x86-64 (well past the failure point failing
> > later for unrelated reason), but the problem ineed reproduce for me on
> > i686 machine.
> > 
> > The problem is more stubble - the reference to dead SSA name is caused
> > by Ada language specific part of declaration holding pointers to random
> > parts of GIMPLE statements.
> > It would be great if those pointers was cleared after gimplification by
> > Ada, but I am not familiar enough with that frontend to try that.
> > 
> > I am testing the attached patch. You are definitly right that the
> > original early optimization patch should've been tested with Ada.  The
> > frontend dependency didn't arrised to me.  At least I am re-testing with
> > Ada the early inlining/early optimization patch I intend to commit
> > today now.
> 
> with this patch Ada bootstrap gets as far as stage3 (a big improvement).  It
> dies in stage3 due to a failed check in ipa-type-escape.c:
> 
> +===========================GNAT BUG DETECTED==============================+
> | 4.3.0 20070116 (experimental) (i686-pc-linux-gnu) GCC error:             |
> | tree check: expected class ???expression???, have ???constant???         |
> |     (real_cst) in look_for_casts, at ipa-type-escape.c:930               |
> | Error detected at a-numaux.adb:572:1                                     |
> | Please submit a bug report; see http://gcc.gnu.org/bugs.html.            |
> | Use a subject line meaningful to you and us to track the bug.            |
> | Include the entire contents of this bug box in the report.               |
> | Include the exact gcc or gnatmake command that you entered.              |
> | Also include sources listed below in gnatchop format                     |
> | (concatenated together with no headers between files).                   |
> +==========================================================================+

Hi,
curiously enough this failure does not reproduce for me (again, I've just
completted i386 and x86-64 bootstrap).  But from your testcase the
problem is ipa-type-escape getting confused by operand
componen_ref(view_convert_expr(integer_exp))
This is valid gimple, but we probably didn't produced it before constant
propagation in early optimizations was enabled.

This is patch we are testing, thanks to Danny

	* ipa-type-escape.c (look_for_casts): Rewrite handling of
	VIEW_CONVERT_EXPRs.
Index: ipa-type-escape.c
===================================================================
--- ipa-type-escape.c	(revision 120777)
+++ ipa-type-escape.c	(working copy)
@@ -920,26 +920,21 @@ look_for_casts (tree lhs __attribute__((
       tree castfromvar = TREE_OPERAND (t, 0);
       check_cast (TREE_TYPE (t), castfromvar);
     }
-  else if (TREE_CODE (t) == COMPONENT_REF
-	   || TREE_CODE (t) == INDIRECT_REF
-	   || TREE_CODE (t) == BIT_FIELD_REF)
-    {
-      tree base = get_base_address (t);
-      while (t != base)
-	{
-	  t = TREE_OPERAND (t, 0);
-	  if (TREE_CODE (t) == VIEW_CONVERT_EXPR)
-	    {
-	      /* This may be some part of a component ref.
-		 IE it may be a.b.VIEW_CONVERT_EXPR<weird_type>(c).d, AFAIK.
-		 castfromref will give you a.b.c, not a. */
-	      tree castfromref = TREE_OPERAND (t, 0);
-	      check_cast (TREE_TYPE (t), castfromref);
-	    }
-	  else if (TREE_CODE (t) == COMPONENT_REF)
-	    get_canon_type (TREE_TYPE (TREE_OPERAND (t, 1)), false, false);
-	}
-    } 
+  else
+    while (handled_component_p (t))
+      {
+	t = TREE_OPERAND (t, 0);
+	if (TREE_CODE (t) == VIEW_CONVERT_EXPR)
+	  {
+	    /* This may be some part of a component ref.
+	       IE it may be a.b.VIEW_CONVERT_EXPR<weird_type>(c).d, AFAIK.
+	       castfromref will give you a.b.c, not a. */
+	    tree castfromref = TREE_OPERAND (t, 0);
+	    check_cast (TREE_TYPE (t), castfromref);
+	  }
+	else if (TREE_CODE (t) == COMPONENT_REF)
+	  get_canon_type (TREE_TYPE (TREE_OPERAND (t, 1)), false, false);
+      }
 } 
 
 /* Check to see if T is a read or address of operation on a static var


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