This is the mail archive of the gcc@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]

20011119-1.c failure (Re: Gcc mainline failed to bootstrap on Linux/ia64)


> FAIL: gcc.c-torture/compile/20000120-2.c (test for excess errors)
> FAIL: gcc.c-torture/compile/20011119-1.c (test for excess errors)
> FAIL: gcc.dg/debug/20010207-1.c (test for excess errors)
> 
> are failing on a lot of systems and have been for a while.  In fact, they
> all fail on AIX as well. The testcases are questionable.

I see now failure of 20011119-1.c on i386 too.  The problem is that
re-definition of function kills the saved function body:

extern inline int foo (void) { return 23; }
int xxx(void) __asm__("xxx");
int xxx(void) { return 23; }
extern int foo (void) __attribute__ ((weak, alias ("xxx")));

I do have patch to keep it (attached), but I am not convienced that it
is good idea to allow such a construct.  Would be possible to error on
this?   If so, any idea what exactly test?  Or does the attached patch
look OK?

Honza

Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.444
diff -c -3 -p -r1.444 c-decl.c
*** c-decl.c	8 Sep 2003 15:56:17 -0000	1.444
--- c-decl.c	9 Sep 2003 00:29:52 -0000
*************** duplicate_decls (tree newdecl, tree oldd
*** 1480,1493 ****
      return 0;
  
    /* Copy most of the decl-specific fields of NEWDECL into OLDDECL.
!      But preserve OLDDECL's DECL_UID.  */
    {
      unsigned olddecl_uid = DECL_UID (olddecl);
  
      memcpy ((char *) olddecl + sizeof (struct tree_common),
  	    (char *) newdecl + sizeof (struct tree_common),
  	    sizeof (struct tree_decl) - sizeof (struct tree_common));
      DECL_UID (olddecl) = olddecl_uid;
    }
  
    /* NEWDECL contains the merged attribute lists.
--- 1480,1500 ----
      return 0;
  
    /* Copy most of the decl-specific fields of NEWDECL into OLDDECL.
!      But preserve OLDDECL's DECL_UID and function body.
!      The function body needs to be preserved only for case where extern
!      inline function is later re-declared with different linkage.
!      See testsuite/gcc.c-torture/compile/20011119-2.c.  */
    {
      unsigned olddecl_uid = DECL_UID (olddecl);
+     tree saved_tree = (TREE_CODE (olddecl) == FUNCTION_DECL
+ 	    	       ? DECL_SAVED_TREE (olddecl) : NULL);
  
      memcpy ((char *) olddecl + sizeof (struct tree_common),
  	    (char *) newdecl + sizeof (struct tree_common),
  	    sizeof (struct tree_decl) - sizeof (struct tree_common));
      DECL_UID (olddecl) = olddecl_uid;
+     if (saved_tree && !DECL_SAVED_TREE (olddecl))
+       DECL_SAVED_TREE (olddecl) = saved_tree;
    }
  
    /* NEWDECL contains the merged attribute lists.


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