[Patch, fortran] PR58618 - Wrong code with character substring and ASSOCIATE
Tobias Burnus
burnus@net-b.de
Wed Oct 17 21:17:00 GMT 2018
Hi Paul,
Paul Richard Thomas wrote:
> This problem concerned associate targets being substrings. It turns
> out that they are returned as pointer types (with a different cast for
> unity based substrings ***sigh***) and so can be assigned directly to
> the associate name. The patch quite simply removed the condition that
> such targets be allocatable, pointer or dummy.
> I noticed in the course of working up the testcase that
> character (:), pointer :: ptr => NULL()
> character (6), target :: tgt = 'lmnopq'
> ptr => tgt
> print *, len (ptr), ptr
> end
> ICEs on the NULL initialization of the pointer but works fine if this
> is removed. Has this already been posted as a PR?
I leave it to Dominique to search for a PR; otherwise, I believe the
attach patch fixes the issue. â It just needs someone to package it with
a test case, regtest and commit it.
> Bootstrapped and regtested on FC28/x86_64 - OK for trunk?
OK â thanks for the fix.
Tobias
> 2018-10-17 Paul Thomas <pault@gcc.gnu.org>
>
> PR fortran/58618
> * trans-stmt.c (trans_associate_var): All strings that return
> as pointer types can be assigned directly to the associate
> name so remove 'attr' and the condition that uses it.
>
> 2018-10-17 Paul Thomas <pault@gcc.gnu.org>
>
> PR fortran/58618
> * gfortran.dg/associate_45.f90 : New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: null-init.diff
Type: text/x-patch
Size: 849 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20181017/6cd6f542/attachment.bin>
More information about the Fortran
mailing list