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, fortran] Add string padding on assignment


On Thu, Sep 30, 2010 at 08:17:06PM +0200, Thomas Koenig wrote:
> I wrote:
> 
> > 
> > 2010-09-27  Thomas Koenig  <tkoenig@gcc.gnu.org>
> > 
> > 	PR fortran/45636
> > 	* frontend-passes.c (optimize_assignment):  In an assignment,
> > 	fill up blanks on the right-hand side if fewer than
> > 	STRING_PAD_LIMIT characters are missing.
> > 
> > 2010-09-27  Thomas Koenig  <tkoenig@gcc.gnu.org>
> > 
> > 	PR fortran/45636
> > 	* gfortran.dg/character_pad_1.f90:  New test.
> > 
> 
> Ping?

I think it would be best to handle this in the middle-end, and if not,
at least use can_store_by_pieces etc. from middle-end to see whether
it is going to be expanded together as a bunch of stores.  Because,
otherwise, .rodata grows.  In your patch you are looking only at the length
of the padding.  Now, if you have a 4KB string in the source and assign it
once to 4KB+1, once to 4KB+2, once to 4KB+3, once 4KB+4, once 4KB+4
character variable, the patch results in 5 ~ 4KB strings in .rodata instead
of just one.

	Jakub


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