public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/102106] New: Intermittent Segfault with associate to derived type with polymorphic component
@ 2021-08-27 20:52 everythingfunctional at protonmail dot com
  2021-12-16 18:03 ` [Bug fortran/102106] Freeing unallocated memory, " fxcoudert at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: everythingfunctional at protonmail dot com @ 2021-08-27 20:52 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102106
           Summary: Intermittent Segfault with associate to derived type
                    with polymorphic component
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: everythingfunctional at protonmail dot com
  Target Milestone: ---

I'm using version Ubuntu 11.1.0-1ubuntu1~21.04 on Pop!OS.

The following program segfaults sometimes. I believe this bug specifically has
to do with the association to a return value with a polymorphic component, but
I occasionally see similar errors when associating to more complicated derived
types (i.e. derived types with derived type components, with derived type
components, etc.), even if they aren't polymorphic. I think it only happens if
there is an allocatable component somewhere in the hierarchy though.

I've been encountering this bug (and possibly other related ones) occasionally
for a while now, and was finally able to reproduce it in something small to
hopefully be able to isolate it.

program main
    type :: sub_class_t
    end type

    type :: with_polymorphic_component_t
        class(sub_class_t), allocatable :: sub_obj_
    end type

    associate(obj => with_polymorphic_component_t(sub_class_t()))
    end associate
end program

Note: in my testing this segfaults about 1 out of every 10 executions

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

end of thread, other threads:[~2023-04-08  9:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-27 20:52 [Bug libfortran/102106] New: Intermittent Segfault with associate to derived type with polymorphic component everythingfunctional at protonmail dot com
2021-12-16 18:03 ` [Bug fortran/102106] Freeing unallocated memory, " fxcoudert at gcc dot gnu.org
2021-12-16 18:05 ` fxcoudert at gcc dot gnu.org
2023-04-08  8:04 ` cvs-commit at gcc dot gnu.org
2023-04-08  9:35 ` pault 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).