[PATCH][LTO] Fix PR41821

Richard Guenther rguenther@suse.de
Tue Oct 27 12:55:00 GMT 2009


This fixes PR41821 - we were missing to handle OFFSET_TYPE in
gimple_types_compatible_p.  Fixed as follows.

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

Richard.

2009-10-27  Richard Guenther  <rguenther@suse.de>

	PR lto/41821
	* gimple.c (gimple_types_compatible_p): Handle OFFSET_TYPE.

Index: trunk/gcc/gimple.c
===================================================================
*** trunk.orig/gcc/gimple.c	2009-10-27 10:43:41.000000000 +0100
--- trunk/gcc/gimple.c	2009-10-27 10:55:13.000000000 +0100
*************** gimple_types_compatible_p (tree t1, tree
*** 3198,3204 ****
        || SCALAR_FLOAT_TYPE_P (t1)
        || FIXED_POINT_TYPE_P (t1)
        || TREE_CODE (t1) == VECTOR_TYPE
!       || TREE_CODE (t1) == COMPLEX_TYPE)
      {
        /* Can't be the same type if they have different alignment,
  	 sign, precision or mode.  */
--- 3198,3205 ----
        || SCALAR_FLOAT_TYPE_P (t1)
        || FIXED_POINT_TYPE_P (t1)
        || TREE_CODE (t1) == VECTOR_TYPE
!       || TREE_CODE (t1) == COMPLEX_TYPE
!       || TREE_CODE (t1) == OFFSET_TYPE)
      {
        /* Can't be the same type if they have different alignment,
  	 sign, precision or mode.  */
*************** gimple_types_compatible_p (tree t1, tree
*** 3343,3348 ****
--- 3344,3359 ----
  	    }
  	}
  
+     case OFFSET_TYPE:
+       {
+ 	if (!gimple_types_compatible_p (TREE_TYPE (t1), TREE_TYPE (t2))
+ 	    || !gimple_types_compatible_p (TYPE_OFFSET_BASETYPE (t1),
+ 					   TYPE_OFFSET_BASETYPE (t2)))
+ 	  goto different_types;
+ 
+ 	goto same_types;
+       }
+ 
      case POINTER_TYPE:
      case REFERENCE_TYPE:
        {



More information about the Gcc-patches mailing list