Pre-inline optimization, version 3

Duncan Sands baldrick@free.fr
Tue Jan 16 14:24:00 GMT 2007


With this patch and the previous one applied, Ada bootstraps successfully (i686).

Thanks a lot,

Duncan.

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



More information about the Gcc-patches mailing list