This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, Fortran, OOP] PR 78848: [7 Regression] ICE on writing CLASS variable with non-typebound DTIO procedure
- From: Janus Weil <janus at gcc dot gnu dot org>
- To: Paul Richard Thomas <paul dot richard dot thomas at gmail dot com>
- Cc: gfortran <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 18 Dec 2016 14:31:48 +0100
- Subject: Re: [Patch, Fortran, OOP] PR 78848: [7 Regression] ICE on writing CLASS variable with non-typebound DTIO procedure
- Authentication-results: sourceware.org; auth=none
- References: <CAKwh3qgeme8NB8W3dPSsu8N2wA-TqtAaW+z9CgcUoHm8+UjYcQ@mail.gmail.com> <CAGkQGi+GD2=RMRKYVaUD=40-uJkpLc66Q43EnKPasLdkxMt+hw@mail.gmail.com>
Hi Paul,
> Thanks for taking on the cleaning up of the dtio for me. I am up to my
> eyeballs in things other than gfortran.
>
> This patch is OK for trunk since it fixes a regression.
thanks for the review. Committed as r243784.
> Looking at it, though, I realised that dynamic dispatch would be
> possible. If, as each derived type is being resolved, specific DTIO
> procedures are found in generic interfaces, they could be added to the
> derived type's vtable. This is possibly an unnecessary embellishment
> but it could be done. Please commit this fix for now, however.
Yes, I agree that technically it would be possible to do this.
However, I doubt that the standard requires us to do it. I just had a
look in chapter 9.5.3.7.3 of the F03 standard, which says:
----
(2) A suitable user-defined derived-type input/output procedure is
available; that is, either
(a) the declared type of the effective item has a suitable generic
type-bound procedure,
or
(b) a suitable generic interface is accessible.
If (2a) is true, the procedure referenced is determined as for
explicit type-bound procedure references
(12.4); that is, the binding with the appropriate specific interface
is located in the declared type of the
effective item, and the corresponding binding in the dynamic type of
the effective item is selected.
If (2a) is false and (2b) is true, the reference is to the procedure
identified by the appropriate specific
interface in the interface block. This reference shall not be to a
dummy procedure that is not present,
or to a disassociated procedure pointer.
---
To me this sound like a typebound DTIO procedure should indeed behave
differently than a non-typebound one, thus I think what you're
proposing is not necessary. Do you agree?
Cheers,
Janus
> On 18 December 2016 at 13:12, Janus Weil <janus@gcc.gnu.org> wrote:
>> Hi all,
>>
>> the attached patch fixes an ICE on a valid DTIO example, which is in
>> fact a regression of one of my recent patches. See bugzilla for
>> details.
>>
>> Regtests cleanly on x86_64-linux-gnu. Ok for trunk?
>>
>> Cheers,
>> Janus
>>
>>
>> 2016-12-18 Janus Weil <janus@gcc.gnu.org>
>>
>> PR fortran/78848
>> * trans-io.c (get_dtio_proc): Generate non-typebound DTIO call for class
>> variables, if no typebound DTIO procedure is available.
>>
>> 2016-12-18 Janus Weil <janus@gcc.gnu.org>
>>
>> PR fortran/78848
>> * gfortran.dg/dtio_22.f90: New test.
>
>
>
> --
> If you're walking down the right path and you're willing to keep
> walking, eventually you'll make progress.
>
> Barack Obama