i386_comp_type_attributes correction

Richard Henderson rth@cygnus.com
Fri Oct 30 13:29:00 GMT 1998


Your patch was not quite correct, as it would reject this test case.
  
  static int internal_addseverity (int severity, const char *string)
       __attribute__ ((regparm (3), stdcall));
  
  int
  __attribute__ ((regparm (3), stdcall))
  internal_addseverity (int severity, const char *string)
  {
    return 0;
  }
  
  int foo () { internal_addseverity (0, ""); }

The bug being that you only want to check if both attributes are set,
not whether both have the same tree node.  I've committed the following
fix.


r~


Fri Oct 30 13:23:20 1998  Richard Henderson  <rth@cygnus.com>

        * i386.c (i386_comp_type_attributes): Compare whether the 
        attributes are defined, not their tree nodes.

Index: config/i386/i386.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/i386/i386.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -c -p -d -r1.44 -r1.45
*** i386.c	1998/10/29 21:37:24	1.44
--- i386.c	1998/10/30 13:24:33	1.45
*************** i386_comp_type_attributes (type1, type2)
*** 632,639 ****
      return 1;
  
    /* Check for mismatched return types (cdecl vs stdcall).  */
!   if (lookup_attribute (rtdstr, TYPE_ATTRIBUTES (type1))
!       != lookup_attribute (rtdstr, TYPE_ATTRIBUTES (type2)))
      return 0;
    return 1;
  }
--- 632,639 ----
      return 1;
  
    /* Check for mismatched return types (cdecl vs stdcall).  */
!   if (!lookup_attribute (rtdstr, TYPE_ATTRIBUTES (type1))
!       != !lookup_attribute (rtdstr, TYPE_ATTRIBUTES (type2)))
      return 0;
    return 1;
  }



More information about the Gcc-patches mailing list