public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/111341] New: Elemental operator on zero-sized array seg-faults
@ 2023-09-08 19:13 everythingfunctional at protonmail dot com
  2023-09-10  5:17 ` [Bug fortran/111341] " kargl at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: everythingfunctional at protonmail dot com @ 2023-09-08 19:13 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111341
           Summary: Elemental operator on zero-sized array seg-faults
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: everythingfunctional at protonmail dot com
  Target Milestone: ---

There were some scenarios in the real code for this that it doesn't segfault,
but the following reproducer was able to do it reliably for me.

fpm.toml

name = "empty_elemental"
version = "0.1.0"
license = "license"
author = "Brad Richardson"
maintainer = "everythingfunctional@protonmail.com"
copyright = "Copyright 2023, Brad Richardson"

[dependencies]
strff = { git = "https://gitlab.com/everythingfunctional/strff.git", tag =
"v4.0.0" }
iso_varying_string = { git =
"https://gitlab.com/everythingfunctional/iso_varying_string.git", tag =
"v3.0.3" }

app/main.f90

program main
  use iso_varying_string, only: varying_string, operator(//), put_line
  use strff, only: join

  implicit none

  call put_line(join("'" // empty() // "'", ","))
contains
  pure function empty()
    type(varying_string), allocatable :: empty(:)
    allocate(empty(0))
  end function
end program main

For context, varying_string just has an allocatable deferred length character
component, operator(//) is elemental, join concatenates an array of strings
with the given separator between each, and put_line is basically just print for
varying_string. So the above program should just print a single, zero length
character.

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

end of thread, other threads:[~2023-09-11 18:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-08 19:13 [Bug fortran/111341] New: Elemental operator on zero-sized array seg-faults everythingfunctional at protonmail dot com
2023-09-10  5:17 ` [Bug fortran/111341] " kargl at gcc dot gnu.org
2023-09-11 13:49 ` everythingfunctional at protonmail dot com
2023-09-11 18:29 ` 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).