[Bug fortran/105800] New: Segfault deallocating a class, dimension(:) array

mscfd at gmx dot net gcc-bugzilla@gcc.gnu.org
Wed Jun 1 09:44:54 GMT 2022


            Bug ID: 105800
           Summary: Segfault deallocating a class, dimension(:) array
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mscfd at gmx dot net
  Target Milestone: ---

Created attachment 53062
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53062&action=edit
test class_dealloc.f90

Creating an array in a function with return value "type(t), dimension(:)", and
assigning it to a "class(t), dimension(:)" variable eventually leads to a
segfault when deallocating the array. See attached test.

valgrind shows invalid read due to uninitialised value (presumably the
type-descriptor of the "class(t), dimension(:)" variable is not completely
initialised). If the "type(t)" is changed to "class(t)" in the create function,
then it works fine, without any complains from valgrind.

More information about the Gcc-bugs mailing list