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]

Re: [PATCH] PR optimization/12324


> On Fri, 3 Oct 2003, Bernardo Innocenti wrote:
> 
> >         (const phy_cmd_t []) {  /* config */
> 
> So here the initializer is a pointer to a compound literal - and that
> compound literal would naturally get written out exactly once (in the
> absence of being deferred).  The problem case which I think is why Jakub
> made them deferred is if the initializer is a compound literal of
> structure - not array - type (permitted as an extension in gnu89 mode),
> where it gets included in the larger initializer and shouldn't get emitted
> on its own as well.

Now I see.  So all we need is dead function ellimination.  There is
testcase in testsuite for this too and didn't break with my previous
patch.  The patch however makes the initializer to be output when not
optimizing that is wrong I guess.  does the attached patch look OK?

Mon Oct  6 11:10:36 CEST 2003  Jan Hubicka  <jh@suse.cz>
	PR opt/12324
	* c-decl.c (build_compound_literal):  Set DECL_DEFER_OUTPUT only when not
	doing unit-at-a-time.
Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.454
diff -c -3 -p -r1.454 c-decl.c
*** c-decl.c	4 Oct 2003 16:49:26 -0000	1.454
--- c-decl.c	6 Oct 2003 09:10:19 -0000
*************** build_compound_literal (tree type, tree 
*** 3088,3094 ****
  			       compound_literal_number);
        compound_literal_number++;
        DECL_NAME (decl) = get_identifier (name);
!       DECL_DEFER_OUTPUT (decl) = 1;
        DECL_COMDAT (decl) = 1;
        DECL_ARTIFICIAL (decl) = 1;
        pushdecl (decl);
--- 3088,3098 ----
  			       compound_literal_number);
        compound_literal_number++;
        DECL_NAME (decl) = get_identifier (name);
! 
!       /* We need the unused static initializers to be elliminated.  These may
!          be created using GNU extensions.  */
!       if (!flag_unit_at_a_time)
!         DECL_DEFER_OUTPUT (decl) = 1;
        DECL_COMDAT (decl) = 1;
        DECL_ARTIFICIAL (decl) = 1;
        pushdecl (decl);


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