This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch, fortran] Add string padding on assignment
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Thomas Koenig <tkoenig at netcologne dot de>
- Cc: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Thu, 30 Sep 2010 20:31:07 +0200
- Subject: Re: [patch, fortran] Add string padding on assignment
- References: <1285613431.7401.5.camel@linux-fd1f.site> <1285870626.3566.0.camel@linux-fd1f.site>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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