public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/105800] New: Segfault deallocating a class, dimension(:) array
@ 2022-06-01  9:44 mscfd at gmx dot net
  2023-04-14  5:07 ` [Bug fortran/105800] " mscfd at gmx dot net
  2023-04-14 19:20 ` anlauf at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: mscfd at gmx dot net @ 2022-06-01  9:44 UTC (permalink / raw)
  To: gcc-bugs

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

            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.

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

* [Bug fortran/105800] Segfault deallocating a class, dimension(:) array
  2022-06-01  9:44 [Bug fortran/105800] New: Segfault deallocating a class, dimension(:) array mscfd at gmx dot net
@ 2023-04-14  5:07 ` mscfd at gmx dot net
  2023-04-14 19:20 ` anlauf at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: mscfd at gmx dot net @ 2023-04-14  5:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from martin <mscfd at gmx dot net> ---
Created attachment 54856
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54856&action=edit
fixed testcase class_dealloc.f90

As I just see, the first attachment does not show the bug as return value "a"
of function create is declared as "class(t), dimension(:), pointer". And as
described in the initial report, with class instead of type, there is no error.

The fixed attachment declares "a" as "type(t), dimension(:), pointer". This
shows the described error. It is still present in the current 13 development
branch.

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

* [Bug fortran/105800] Segfault deallocating a class, dimension(:) array
  2022-06-01  9:44 [Bug fortran/105800] New: Segfault deallocating a class, dimension(:) array mscfd at gmx dot net
  2023-04-14  5:07 ` [Bug fortran/105800] " mscfd at gmx dot net
@ 2023-04-14 19:20 ` anlauf at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-04-14 19:20 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2023-04-14

--- Comment #2 from anlauf at gcc dot gnu.org ---
(In reply to martin from comment #1)
> The fixed attachment declares "a" as "type(t), dimension(:), pointer". This
> shows the described error. It is still present in the current 13 development
> branch.

It is the pointer assignment in subroutine init

    self%x => a

that fails.

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

end of thread, other threads:[~2023-04-14 19:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-01  9:44 [Bug fortran/105800] New: Segfault deallocating a class, dimension(:) array mscfd at gmx dot net
2023-04-14  5:07 ` [Bug fortran/105800] " mscfd at gmx dot net
2023-04-14 19:20 ` 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).