This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, fortran] PR51976 - [F2003] Support deferred-length character components of derived types (allocatable string length)
- From: Janus Weil <janus at gcc dot gnu dot org>
- To: Paul Richard Thomas <paul dot richard dot thomas at gmail dot com>
- Cc: Mikael Morin <mikael dot morin at sfr dot fr>, Tobias Burnus <burnus at net-b dot de>, gcc-patches <gcc-patches at gcc dot gnu dot org>, "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>
- Date: Thu, 6 Mar 2014 22:55:09 +0100
- Subject: Re: [Patch, fortran] PR51976 - [F2003] Support deferred-length character components of derived types (allocatable string length)
- Authentication-results: sourceware.org; auth=none
- References: <CAGkQGiLC5jgtEb18P0F1GTmJsvU=u0eEF4OpUkVM320a64bpGQ at mail dot gmail dot com> <5148D5DF dot 9000508 at net-b dot de> <CAKwh3qjZzr_5nd=AwHDW-t2Oo3VQrwMpO3Jj3mEufmKQKq-dqQ at mail dot gmail dot com> <CAKwh3qhiANiAz6ahj9YjHK=quZLyy2rFXkGui=uk-8cNLt2TWA at mail dot gmail dot com> <5308C48C dot 9080102 at sfr dot fr> <CAKwh3qiyDMFkRk=_D5XRpKhsnWp3AbNseZPbtcT_iGjMTYug3Q at mail dot gmail dot com> <5316F34A dot 9060702 at sfr dot fr> <CAKwh3qhWWMh3xTKGZUVXDoPnuDVOYkHbGmnsbxbuq2SN0_-YOg at mail dot gmail dot com> <CAGkQGiLbe7oLHC8N7OCALdTOVP8-COyCAmCUj-AfZK_DAAHqRA at mail dot gmail dot com> <CAKwh3qjqiUm1a3moCrNFR6xngFG60E7-iKSe6m96WPpVWQLGOQ at mail dot gmail dot com> <CAGkQGiK6v5WhibMJWMOzq=npWk5N1mGFJYEFV0tL6vf9+Xp4MQ at mail dot gmail dot com> <CAKwh3qgaPTDY7cmXGkegtkthMYR4SbBTXwy5CiAn5+AysqJA_g at mail dot gmail dot com>
>> Please commit the patch to trunk.
>
> Will do!
I have just committed the patch as r208386, thereby implementing
deferred-length character components on 4.9 trunk. One big plea to the
users: Please test this as soon as possible!
Cheers,
Janus
>> On Mar 6, 2014 9:59 PM, "Janus Weil" <janus@gcc.gnu.org> wrote:
>>>
>>> Hi Paul,
>>>
>>> > I am trying to respond to Mikael's comment that only kind=1 is handled.
>>> > I'll
>>> > use your patch as a basis.
>>>
>>> actually the last version of the patch that I posted yesterday should
>>> already handle that (and includes a kind=4 test case). But if you find
>>> any remaining problems, please let me know.
>>>
>>> Also Tobias already told me privately that his "mixed feeling" were
>>> not strong enough to oppose against committing the patch. So right now
>>> the only thing standing between the patch and trunk seems to be you ;)
>>>
>>> Cheers,
>>> Janus
>>>
>>>
>>>
>>> > On Mar 5, 2014 2:53 PM, "Janus Weil" <janus@gcc.gnu.org> wrote:
>>> >>
>>> >> Hi Mikael,
>>> >>
>>> >> >> The patch was regtested on x86_64-unknown-linux-gnu. Ok for trunk?
>>> >> >>
>>> >> > I'm asking for one more minor change, namely:
>>> >> >
>>> >> >> @@ -12364,6 +12356,25 @@ resolve_fl_derived0 (gfc_symbol *sym)
>>> >> >> return false;
>>> >> >> }
>>> >> >>
>>> >> >> + /* Add the hidden deferred length field. */
>>> >> >> + if (c->ts.type == BT_CHARACTER && c->ts.deferred &&
>>> >> >> !c->attr.function
>>> >> >> + && !sym->attr.is_class)
>>> >> >> + {
>>> >> >> + char name[GFC_MAX_SYMBOL_LEN+1];
>>> >> >> + gfc_component *strlen;
>>> >> >> + sprintf (name, "_%s", c->name);
>>> >> >
>>> >> > It's not more costly to have a more explicit name like "_%s_length"
>>> >> > or
>>> >> > something, and I prefer having the latter in complicated dumps or in
>>> >> > the
>>> >> > debugger.
>>> >>
>>> >> I agree.
>>> >>
>>> >>
>>> >> > OK with that change, with the associated buffer size update. Also
>>> >> > Steve
>>> >> > noted that the buffer size should take the terminating null character
>>> >> > into account.
>>> >>
>>> >> Steve's comment somehow got lost in the noise. I have updated both the
>>> >> name and the buffer size now in resolve_fl_derived0 as well as
>>> >> gfc_deferred_strlen. Updated patch attached.
>>> >>
>>> >> A few people expressed mixed feelings, therefore I'll wait a couple of
>>> >> days to allow the naysayers to chime in. In the absence of further
>>> >> feedback, I'll commit the patch on the weekend.
>>> >>
>>> >> Cheers,
>>> >> Janus