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/110288] [11/12/13/14] Regression: segfault in findloc with allocatable array of allocatable characters
Date: Sun, 09 Jul 2023 20:38:03 +0000	[thread overview]
Message-ID: <bug-110288-4-wCvWIDPaPY@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110288-4@http.gcc.gnu.org/bugzilla/>

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #2 from anlauf at gcc dot gnu.org ---
Interesting bug.

Modified testcase:

program test
  character(len=:), allocatable, dimension(:) :: array
  array = ["bb", "aa"]
  print *, findloc (array, "aa", dim=1, kind=8)
contains
  subroutine sub (str)
    character(*), intent(in) :: str(:)
!   print *, findloc (str, "bb", dim=1, kind=8) ! (un-)comment this line!
  end
end program test

The tree-dump shows for the findloc call:

D.4354 = _gfortran_findloc2_s1 (&parm.3, &"aa"[1]{lb: 1 sz: 1}, 0, &.array, 2);

Note that we pass an address where we should pass the dereferenced length.

Uncommenting the marked line, we get instead (for the same source line!):

D.4374 = _gfortran_findloc2_s1 (&parm.9, &"aa"[1]{lb: 1 sz: 1}, 0, .array, 2);

Indeed this variant is fine and runs fine.

  parent reply	other threads:[~2023-07-09 20:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-16 14:46 [Bug fortran/110288] New: [11/12/13] " zed.three at gmail dot com
2023-06-16 16:38 ` [Bug fortran/110288] [11/12/13/14] " anlauf at gcc dot gnu.org
2023-07-09 20:38 ` anlauf at gcc dot gnu.org [this message]
2023-07-10 20:50 ` anlauf at gcc dot gnu.org
2023-07-11 18:21 ` anlauf at gcc dot gnu.org
2023-07-11 19:40 ` anlauf at gcc dot gnu.org
2023-07-11 20:26 ` cvs-commit at gcc dot gnu.org
2023-07-13 17:38 ` anlauf at gcc dot gnu.org
2023-07-14 18:27 ` cvs-commit at gcc dot gnu.org
2023-07-14 18:32 ` cvs-commit at gcc dot gnu.org
2023-07-14 18:35 ` cvs-commit at gcc dot gnu.org
2023-07-14 18:39 ` 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-110288-4-wCvWIDPaPY@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).