public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Paul Richard Thomas <paul.richard.thomas@gmail.com>
To: Harald Anlauf <anlauf@gmx.de>
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: Thu, 13 Apr 2023 07:18:01 +0100	[thread overview]
Message-ID: <CAGkQGiJ_dqW4HH4jVXLLdC9m+JCL53bH1wCwq70GR5kE_wNLpQ@mail.gmail.com> (raw)
In-Reply-To: <2ef9c2f2-2b56-2dd1-15cb-ff3318ea1315@gmx.de>

[-- Attachment #1: Type: text/plain, Size: 1819 bytes --]

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

  reply	other threads:[~2023-04-13  6:18 UTC|newest]

Thread overview: 5+ 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-13  6:18   ` Paul Richard Thomas [this message]
2023-04-14  8:18     ` Paul Richard Thomas
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=CAGkQGiJ_dqW4HH4jVXLLdC9m+JCL53bH1wCwq70GR5kE_wNLpQ@mail.gmail.com \
    --to=paul.richard.thomas@gmail.com \
    --cc=anlauf@gmx.de \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    /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).