This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, PR fortran/45170] -- properly translates substring reference
- From: Mikael Morin <mikael dot morin at sfr dot fr>
- To: fortran at gcc dot gnu dot org
- Cc: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>, gcc-patches at gcc dot gnu dot org
- Date: Sun, 28 Aug 2011 23:36:42 +0200
- Subject: Re: [PATCH, PR fortran/45170] -- properly translates substring reference
- References: <20110827003424.GA55073@troutmask.apl.washington.edu>
On Saturday 27 August 2011 02:34:24 Steve Kargl wrote:
> The attached patch allows gfortran to compile the
> attached testcase. The resulting executable runs
> as expected.
>
> Short story:
>
> character(len=20) :: string = 'some text here'
> character(len=:), allocatable :: s
> n = 5
> allocate(s, source=string(:n))
>
> The length of s is determined from the expression in
> the source= argument. If this expression is a lonely
> substring reference as in the above, then gfortran
> does set the correct length. This patch fixes this.
... does *not* set the correct length, I suppose?
> OK for trunk?
It is OK. Rather obvious. Thanks
Mikael