public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/111265] New: Compiler segfault with character array in deferred type, when returned by a function
@ 2023-09-01  7:48 mailling-lists-bd at posteo dot de
  0 siblings, 0 replies; only message in thread
From: mailling-lists-bd at posteo dot de @ 2023-09-01  7:48 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111265
           Summary: Compiler segfault with character array in deferred
                    type, when returned by a function
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mailling-lists-bd at posteo dot de
  Target Milestone: ---

Hi,

the following code is giving a compiler segfault with Gfortran 13.2.1 on
Fedora, when compiled with `gfortran -c test.f90`.

``` test.f90
module mod_abs_type
  implicit none

  type, abstract :: my_abs_type_t
     private
     character(len=1024), allocatable :: str_(:)
   contains
     private
     procedure, public :: str
  end type my_abs_type_t

contains
  pure function str(self) result(res)
    class(my_abs_type_t), intent(in) :: self
    character(len=1024), allocatable :: res(:)

    allocate(res(size(self%str_)))
    res(:) = self%str_(:)
  end function str
end module mod_abs_type

module mod_container
  use mod_abs_type, only: my_abs_type_t
  implicit none

  type :: my_container_t
     private
     class(my_abs_type_t), allocatable :: ele
   contains
     private
     procedure, public :: str
  end type my_container_t

contains

  pure function str(self) result(res)
    class(my_container_t), intent(in) :: self

    character(len=1024), allocatable :: res(:)

    res = self%ele%str()
  end function str

end module mod_container
```

The error message is:

   42 |     res = self%ele%str()
      |                        1
internal compiler error: Segmentation fault
Please submit a full bug report, with preprocessed source.
See <http://bugzilla.redhat.com/bugzilla> for instructions.

Thanks !

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-09-01  7:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-01  7:48 [Bug fortran/111265] New: Compiler segfault with character array in deferred type, when returned by a function mailling-lists-bd at posteo dot de

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