public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "anlauf at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/113911] New: [14 Regression] Length is lost passing deferred-length character to subroutine
Date: Tue, 13 Feb 2024 18:28:52 +0000	[thread overview]
Message-ID: <bug-113911-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 113911
           Summary: [14 Regression] Length is lost passing deferred-length
                    character to subroutine
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anlauf at gcc dot gnu.org
  Target Milestone: ---

As reported in

https://gcc.gnu.org/pipermail/fortran/2024-February/060224.html

the following testcase regressed after commit r14-8947:

program p
   implicit none
   integer, parameter :: n = 100, l = 10
   character(l) :: a = 'a234567890', b(n) = 'bcdefghijk'
   character(:), allocatable :: d, e(:)
   allocate (d, source=a)
   allocate (e, source=b)
   print *, len (d), len (e), size (e)
   call not_bindc_optional_deferred (d, e)
   deallocate (d, e)
contains
   subroutine not_bindc_optional_deferred (c5, c6)
     character(:), allocatable, optional :: c5, c6(:)
     if (.not. present (c5) .or. .not. present (c6)) stop 6
     print *, len (c5), len (c6), size (c6)
     if (len (c5) /= l .or. len (c6) /= l) stop 84
   end
end

Expected:

           10          10         100
           10          10         100

After above commit:

           10          10         100
           10           0         100
STOP 84

             reply	other threads:[~2024-02-13 18:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-13 18:28 anlauf at gcc dot gnu.org [this message]
2024-02-13 18:29 ` [Bug fortran/113911] " anlauf at gcc dot gnu.org
2024-02-13 19:23 ` anlauf at gcc dot gnu.org
2024-02-13 19:51 ` anlauf at gcc dot gnu.org
2024-02-13 20:02 ` anlauf at gcc dot gnu.org
2024-02-13 20:33 ` anlauf at gcc dot gnu.org
2024-02-13 20:43 ` anlauf at gcc dot gnu.org
2024-02-16 21:44 ` anlauf at gcc dot gnu.org
2024-02-17 14:07 ` cvs-commit at gcc dot gnu.org
2024-02-17 20:19 ` anlauf at gcc dot gnu.org

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-113911-4@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).