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]

[tree-ssa] fix pr 13174


The comment should be descriptive enough.

Bootstrapped and tested on i686-linux.


r~


        PR 13174, PR 13143
        * gimplify.c (cpt_same_type): Allow different ARRAY_TYPEs with
        the same base type.
        * gcc.c-torture/compile/20031124-1.c: New.

Index: gcc/gimplify.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/gimplify.c,v
retrieving revision 1.1.2.121
diff -c -p -d -r1.1.2.121 gimplify.c
*** gcc/gimplify.c	20 Nov 2003 23:36:14 -0000	1.1.2.121
--- gcc/gimplify.c	25 Nov 2003 05:20:21 -0000
*************** cpt_same_type (tree a, tree b)
*** 3318,3332 ****
    if (TYPE_MAIN_VARIANT (a) == TYPE_MAIN_VARIANT (b))
      return true;
  
!   /* ??? Ug.  METHOD_TYPES decompose to FUNCTION_TYPES and they aren't
!      linked together.  Since this routine is intended to catch type errors
       that will affect the optimizers, and the optimizers don't add new
       dereferences of function pointers, so ignore it.  */
    if ((TREE_CODE (a) == FUNCTION_TYPE || TREE_CODE (a) == METHOD_TYPE)
        && (TREE_CODE (b) == FUNCTION_TYPE || TREE_CODE (b) == METHOD_TYPE))
      return true;
  
!   /* And because of that, we have to recurse down through pointers.  */
    if (POINTER_TYPE_P (a) && POINTER_TYPE_P (b))
      return cpt_same_type (TREE_TYPE (a), TREE_TYPE (b));
  
--- 3318,3340 ----
    if (TYPE_MAIN_VARIANT (a) == TYPE_MAIN_VARIANT (b))
      return true;
  
!   /* ??? The C++ FE decomposes METHOD_TYPES to FUNCTION_TYPES and doesn't
!      link them together.  This routine is intended to catch type errors
       that will affect the optimizers, and the optimizers don't add new
       dereferences of function pointers, so ignore it.  */
    if ((TREE_CODE (a) == FUNCTION_TYPE || TREE_CODE (a) == METHOD_TYPE)
        && (TREE_CODE (b) == FUNCTION_TYPE || TREE_CODE (b) == METHOD_TYPE))
      return true;
  
!   /* ??? The C FE pushes type qualifiers after the fact into the type of
!      the element from the type of the array.  See build_unary_op's handling
!      of ADDR_EXPR.  This seems wrong -- if we were going to do this, we
!      should have done it when creating the variable in the first place.
!      Alternately, why aren't the two array types made variants?  */
!   if (TREE_CODE (a) == ARRAY_TYPE && TREE_CODE (b) == ARRAY_TYPE)
!     return cpt_same_type (TREE_TYPE (a), TREE_TYPE (b));
! 
!   /* And because of those, we have to recurse down through pointers.  */
    if (POINTER_TYPE_P (a) && POINTER_TYPE_P (b))
      return cpt_same_type (TREE_TYPE (a), TREE_TYPE (b));
  
Index: gcc/testsuite/gcc.c-torture/compile/20031124-1.c
===================================================================
RCS file: gcc/testsuite/gcc.c-torture/compile/20031124-1.c
diff -N gcc/testsuite/gcc.c-torture/compile/20031124-1.c
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- gcc/testsuite/gcc.c-torture/compile/20031124-1.c	25 Nov 2003 05:20:21 -0000
***************
*** 0 ****
--- 1,8 ----
+ /* PR 13143 */
+ 
+ int f (void *ptr)
+ {
+     extern char const stop[];
+     return ptr >= (void *) &stop;
+ }
+ 


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