From: Harald Anlauf <anlauf@gmx.de>
To: Paul Richard Thomas <paul.richard.thomas@gmail.com>
Cc: "fortran@gcc.gnu.org" <fortran@gcc.gnu.org>,
gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [Patch, fortran] PR109451 - ICE in gfc_conv_expr_descriptor with ASSOCIATE and substrings
Date: Fri, 14 Apr 2023 18:50:31 +0200 [thread overview]
Message-ID: <bfa622af-a837-a725-c359-a5c9e94d5d76@gmx.de> (raw)
In-Reply-To: <CAGkQGi+DmXe1NGqB9LO8ckUeNqeoDMeyGkaShU9PCKyyKboENA@mail.gmail.com>
Hi Paul,
On 4/14/23 10:18, Paul Richard Thomas via Gcc-patches wrote:
> Hi Harald,
>
> The fix was trivial. An updated patch and testcase are attached.
great, this works, and I couldn't break it again this time ...
Looks good!
Thanks,
Harald
> Thanks
>
> Paul
>
> Fortran: Fix some deferred character problems in associate [PR109451]
>
> 2023-04-14 Paul Thomas <pault@gcc.gnu.org>
>
> gcc/fortran
> PR fortran/109451
> * trans-array.cc (gfc_conv_expr_descriptor): Guard expression
> character length backend decl before using it. Suppress the
> assignment if lhs equals rhs.
> * trans-io.cc (gfc_trans_transfer): Scalarize transfer of
> associate variables pointing to a variable. Add comment.
> * trans-stmt.cc (trans_associate_var): Remove requirement that
> the character length be deferred before assigning the value
> returned by gfc_conv_expr_descriptor. Also, guard the backend
> decl before testing with VAR_P.
>
> gcc/testsuite/
> PR fortran/109451
> * gfortran.dg/associate_61.f90 : New test
>
>
> On Thu, 13 Apr 2023 at 07:18, Paul Richard Thomas <
> paul.richard.thomas@gmail.com> wrote:
>
>> Hi Harald,
>>
>> That's interesting - the string length '.q' is not set for either of the
>> associate blocks. I'm onto it.
>>
>> Thanks
>>
>> Paul
>>
>>
>> On Wed, 12 Apr 2023 at 20:26, Harald Anlauf <anlauf@gmx.de> wrote:
>>
>>> Hi Paul,
>>>
>>> On 4/12/23 17:25, Paul Richard Thomas via Gcc-patches wrote:
>>>> Hi All,
>>>>
>>>> I think that the changelog says it all. OK for mainline?
>>>
>>> this looks almost fine, but still fails if one directly uses the
>>> dummy argument as the ASSOCIATE target, as in:
>>>
>>> program p
>>> implicit none
>>> character(4) :: c(2) = ["abcd","efgh"]
>>> call dcs0 (c)
>>> ! call dcs0 (["abcd","efgh"])
>>> contains
>>> subroutine dcs0(a)
>>> character(len=*), intent(in) :: a(:)
>>> print *, size(a),len(a)
>>> associate (q => a(:))
>>> print *, size(q),len(q)
>>> end associate
>>> associate (q => a(:)(:))
>>> print *, size(q),len(q)
>>> end associate
>>> return
>>> end subroutine dcs0
>>> end
>>>
>>> This prints e.g.
>>>
>>> 2 4
>>> 2 0
>>> 2 0
>>>
>>> (sometimes I also get junk values for the character length).
>>>
>>> Can you please have another look?
>>>
>>> Thanks,
>>> Harald
>>>
>>>
>>>> Paul
>>>>
>>>> Fortran: Fix some deferred character problems in associate [PR109451]
>>>>
>>>> 2023-04-07 Paul Thomas <pault@gcc.gnu.org>
>>>>
>>>> gcc/fortran
>>>> PR fortran/109451
>>>> * trans-array.cc (gfc_conv_expr_descriptor): Guard expression
>>>> character length backend decl before using it. Suppress the
>>>> assignment if lhs equals rhs.
>>>> * trans-io.cc (gfc_trans_transfer): Scalarize transfer of
>>>> associate variables pointing to a variable. Add comment.
>>>>
>>>>
>>>> gcc/testsuite/
>>>> PR fortran/109451
>>>> * gfortran.dg/associate_61.f90 : New test
>>>
>>>
>>
>> --
>> "If you can't explain it simply, you don't understand it well enough" -
>> Albert Einstein
>>
>
>
WARNING: multiple messages have this Message-ID
From: Harald Anlauf <anlauf@gmx.de>
To: gcc-patches@gcc.gnu.org
Cc: fortran@gcc.gnu.org
Subject: Re: [Patch, fortran] PR109451 - ICE in gfc_conv_expr_descriptor with ASSOCIATE and substrings
Date: Fri, 14 Apr 2023 18:50:31 +0200 [thread overview]
Message-ID: <bfa622af-a837-a725-c359-a5c9e94d5d76@gmx.de> (raw)
Message-ID: <20230414165031.kCSe8BK_2qxenLxFr8LFMoXt1im2WBO1VgLXUpYmxiQ@z> (raw)
In-Reply-To: <CAGkQGi+DmXe1NGqB9LO8ckUeNqeoDMeyGkaShU9PCKyyKboENA@mail.gmail.com>
Hi Paul,
On 4/14/23 10:18, Paul Richard Thomas via Gcc-patches wrote:
> Hi Harald,
>
> The fix was trivial. An updated patch and testcase are attached.
great, this works, and I couldn't break it again this time ...
Looks good!
Thanks,
Harald
> Thanks
>
> Paul
>
> Fortran: Fix some deferred character problems in associate [PR109451]
>
> 2023-04-14 Paul Thomas <pault@gcc.gnu.org>
>
> gcc/fortran
> PR fortran/109451
> * trans-array.cc (gfc_conv_expr_descriptor): Guard expression
> character length backend decl before using it. Suppress the
> assignment if lhs equals rhs.
> * trans-io.cc (gfc_trans_transfer): Scalarize transfer of
> associate variables pointing to a variable. Add comment.
> * trans-stmt.cc (trans_associate_var): Remove requirement that
> the character length be deferred before assigning the value
> returned by gfc_conv_expr_descriptor. Also, guard the backend
> decl before testing with VAR_P.
>
> gcc/testsuite/
> PR fortran/109451
> * gfortran.dg/associate_61.f90 : New test
>
>
> On Thu, 13 Apr 2023 at 07:18, Paul Richard Thomas <
> paul.richard.thomas@gmail.com> wrote:
>
>> Hi Harald,
>>
>> That's interesting - the string length '.q' is not set for either of the
>> associate blocks. I'm onto it.
>>
>> Thanks
>>
>> Paul
>>
>>
>> On Wed, 12 Apr 2023 at 20:26, Harald Anlauf <anlauf@gmx.de> wrote:
>>
>>> Hi Paul,
>>>
>>> On 4/12/23 17:25, Paul Richard Thomas via Gcc-patches wrote:
>>>> Hi All,
>>>>
>>>> I think that the changelog says it all. OK for mainline?
>>>
>>> this looks almost fine, but still fails if one directly uses the
>>> dummy argument as the ASSOCIATE target, as in:
>>>
>>> program p
>>> implicit none
>>> character(4) :: c(2) = ["abcd","efgh"]
>>> call dcs0 (c)
>>> ! call dcs0 (["abcd","efgh"])
>>> contains
>>> subroutine dcs0(a)
>>> character(len=*), intent(in) :: a(:)
>>> print *, size(a),len(a)
>>> associate (q => a(:))
>>> print *, size(q),len(q)
>>> end associate
>>> associate (q => a(:)(:))
>>> print *, size(q),len(q)
>>> end associate
>>> return
>>> end subroutine dcs0
>>> end
>>>
>>> This prints e.g.
>>>
>>> 2 4
>>> 2 0
>>> 2 0
>>>
>>> (sometimes I also get junk values for the character length).
>>>
>>> Can you please have another look?
>>>
>>> Thanks,
>>> Harald
>>>
>>>
>>>> Paul
>>>>
>>>> Fortran: Fix some deferred character problems in associate [PR109451]
>>>>
>>>> 2023-04-07 Paul Thomas <pault@gcc.gnu.org>
>>>>
>>>> gcc/fortran
>>>> PR fortran/109451
>>>> * trans-array.cc (gfc_conv_expr_descriptor): Guard expression
>>>> character length backend decl before using it. Suppress the
>>>> assignment if lhs equals rhs.
>>>> * trans-io.cc (gfc_trans_transfer): Scalarize transfer of
>>>> associate variables pointing to a variable. Add comment.
>>>>
>>>>
>>>> gcc/testsuite/
>>>> PR fortran/109451
>>>> * gfortran.dg/associate_61.f90 : New test
>>>
>>>
>>
>> --
>> "If you can't explain it simply, you don't understand it well enough" -
>> Albert Einstein
>>
>
>
next prev parent reply other threads:[~2023-04-14 16:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-12 15:25 Paul Richard Thomas
2023-04-12 19:26 ` Harald Anlauf
2023-04-12 19:26 ` Harald Anlauf
2023-04-13 6:18 ` Paul Richard Thomas
2023-04-14 8:18 ` Paul Richard Thomas
2023-04-14 16:50 ` Harald Anlauf [this message]
2023-04-14 16:50 ` Harald Anlauf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bfa622af-a837-a725-c359-a5c9e94d5d76@gmx.de \
--to=anlauf@gmx.de \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=paul.richard.thomas@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).