This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH [mainline] fix -combine bug for parser, gzip of 2000 SPEC benchmark
- From: Fariborz Jahanian <fjahanian at apple dot com>
- To: Richard Henderson <rth at redhat dot com>
- Cc: "gcc-patches at gcc dot gnu dot org Patches" <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 29 Sep 2004 16:51:23 -0700
- Subject: Re: PATCH [mainline] fix -combine bug for parser, gzip of 2000 SPEC benchmark
- References: <611654CA-122F-11D9-98D3-000A95BA54A6@apple.com> <20040929165510.GA4757@redhat.com>
On Sep 29, 2004, at 9:55 AM, Richard Henderson wrote:
On Wed, Sep 29, 2004 at 08:51:08AM -0700, Fariborz Jahanian wrote:
Issued warning tells the whole story.
Perhaps not the whole story. Why does this only come up for
multiple translation units? If I put
extern int sentence[];
int sentence[3];
extern int sentence[];
in one translation unit then things work.
Thanks for the clue. Yes, logic for saving DECL_SIZE is already there.
But it works based on direct type
comparison; something which cannot be relied on when types are coming
from different TUs. Following
patch offers a simple fix. Bootstrapped, dejagnu tested on
apple-ppc-darwin.
OK?
- fariborz (fjahanian@apple.com)
ChangeLog:
2004-09-29 Fariborz Jahanian <fjahanian@apple.com>
* c-decl.c (merge_decls): Use comptype when comparing
types to decide on DECL_SIZE save of olddecl.
Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.590
diff -c -p -r1.590 c-decl.c
*** c-decl.c 28 Sep 2004 19:35:20 -0000 1.590
--- c-decl.c 29 Sep 2004 19:40:46 -0000
*************** merge_decls (tree newdecl, tree olddecl,
*** 1549,1555 ****
= composite_type (newtype, oldtype);
/* Lay the type out, unless already done. */
! if (oldtype != TREE_TYPE (newdecl))
{
if (TREE_TYPE (newdecl) != error_mark_node)
layout_type (TREE_TYPE (newdecl));
--- 1549,1555 ----
= composite_type (newtype, oldtype);
/* Lay the type out, unless already done. */
! if (!comptypes (oldtype, TREE_TYPE (newdecl)))
{
if (TREE_TYPE (newdecl) != error_mark_node)
layout_type (TREE_TYPE (newdecl));
r~