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).                   |
> +==========================================================================+
> 
> Please include these source files with error report
> Note that list may not be accurate in some cases,
> so please double check that the problem can still
> be reproduced with the set of files listed.

Hi,
this is the patch I comitted today after full testing (i686-linux). Hope
that Ada and AIX are bot in bootstrapland now.

Honza

	* ipa-type-escape.c (look_for_casts): Revamp using handled_component_p.
Index: ipa-type-escape.c
===================================================================
*** ipa-type-escape.c	(revision 120835)
--- ipa-type-escape.c	(working copy)
*************** look_for_casts (tree lhs __attribute__((
*** 920,945 ****
        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);
! 	}
!     } 
  } 
  
  /* Check to see if T is a read or address of operation on a static var
--- 920,940 ----
        tree castfromvar = TREE_OPERAND (t, 0);
        check_cast (TREE_TYPE (t), castfromvar);
      }
!   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]