public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pault at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/87448] ICE at trans-expr:3417 in allocate statement with type signature using an associated variable
Date: Wed, 01 Nov 2023 18:08:00 +0000	[thread overview]
Message-ID: <bug-87448-4-TWNgIx9WFX@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-87448-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87448

Paul Thomas <pault at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pault at gcc dot gnu.org

--- Comment #4 from Paul Thomas <pault at gcc dot gnu.org> ---
Created attachment 56484
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56484&action=edit
Fix for this PR

Somehow this missed being a blocker for the ASSOCIATE meta-bug.

The patch is so unbelievably simple that I am going to think about it for 24
hours, even though it regtests just fine :-)

module mod

implicit none
public

contains

function fun(cs) result(rs)
   character(len=:), allocatable :: rs
   character(len=*), intent(in) :: cs

   associate(l => len(cs))
      allocate(character(len=1+l) :: rs)
      write (rs, '(i5)') l
   end associate
end function fun

end module mod

  use mod
  character(:), allocatable :: res
  res = fun("abcd")
  if (res /= '    4') stop 1
end

Gives the expected result.

Paul

  parent reply	other threads:[~2023-11-01 18:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-87448-4@http.gcc.gnu.org/bugzilla/>
2022-01-25  8:37 ` mscfd at gmx dot net
2023-11-01 18:08 ` pault at gcc dot gnu.org [this message]
2023-12-17 17:49 ` anlauf at gcc dot gnu.org
2023-12-18  6:59 ` paul.richard.thomas at gmail dot com

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=bug-87448-4-TWNgIx9WFX@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).