public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/110288] New: [11/12/13] Regression: segfault in findloc with allocatable array of allocatable characters
@ 2023-06-16 14:46 zed.three at gmail dot com
  2023-06-16 16:38 ` [Bug fortran/110288] [11/12/13/14] " anlauf at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: zed.three at gmail dot com @ 2023-06-16 14:46 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110288
           Summary: [11/12/13] Regression: segfault in findloc with
                    allocatable array of allocatable characters
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zed.three at gmail dot com
  Target Milestone: ---

Created attachment 55350
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55350&action=edit
Minimal example source code

The following program crashes with a segfault "invalid memory reference" inside
`findloc`:

  program test
    character(len=:), allocatable, dimension(:) :: array
    array = ["bb", "bb"]
    print*, findloc(array, "aa", dim=1)
  end program

Compiler Explorer example: https://godbolt.org/z/Evrnose5o

The same program works in gfortran 10.4, crashes in 11+, including trunk (GNU
Fortran
(Compiler-Explorer-Build-gcc-7ff793415f55fa9a92f348fecb8c75ac8acc8b87-binutils-2.40)
14.0.0 20230616 (experimental)).

A minimum of two elements in the array are required, and it must be
allocatable, but it doesn't matter if the element is in `array` or not.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-07-14 18:40 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-16 14:46 [Bug fortran/110288] New: [11/12/13] Regression: segfault in findloc with allocatable array of allocatable characters 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
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

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).