public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jhaiduce at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/110987] Segmentation fault after finalization of a temporary variable
Date: Mon, 05 Feb 2024 15:54:36 +0000	[thread overview]
Message-ID: <bug-110987-4-AcJrPq7AQB@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110987-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #6 from John Haiducek <jhaiduce at gmail dot com> ---
I encountered what appears to be the same bug under slightly different
conditions; I've attached the corresponding code (see attachment named
"Additional test case"). In this code the crash occurs when finalizing an
object of a type that inherits from a parent type, where the child type has no
data members of its own.

There are several workarounds that prevent the segmentation fault in this test:
- Create the object with the default constructor rather than using a custom
constructor
- Add a data member to the child type
- Remove the final routine from the child type

I posted the code in the attached "Additional test case" on the Fortran
Discourse (see discussion at
https://fortran-lang.discourse.group/t/segmentation-fault-when-finalizing-an-inherited-type-with-custom-constructor/7319).
From the discussion it was determined that this code triggers a segmentation
fault with the following compiler/OS combinations:
- gfortran 13.2.0 on Ubuntu 23.10 and FreeBSD 14.0
- gfortran 13.2.1 on Fedora 38
- gfortran 13.2.0-13.2.1 on MacOS (arm)

The segmentation fault does not occur on the following compiler/OS
combinations:
- gfortran 11.4.0 on Ubuntu 23.10
- gfortran 12.2.0 on FreeBSD 14.0
- gfortran 14.0.1 experimental on Windows (but in this case there are still
indications of incorrect behavior; no segfault occurred but a print statement
added to the end of the code did not produce any output)

The program also reportedly runs as expected when compiled with ifort.

  parent reply	other threads:[~2024-02-05 15:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-11  9:11 [Bug fortran/110987] New: " chilikin.k at gmail dot com
2023-08-11  9:12 ` [Bug fortran/110987] " chilikin.k at gmail dot com
2023-08-31 18:51 ` chilikin.k at gmail dot com
2023-12-09 13:27 ` chilikin.k at gmail dot com
2024-02-04 20:51 ` anlauf at gcc dot gnu.org
2024-02-05 15:37 ` jhaiduce at gmail dot com
2024-02-05 15:54 ` jhaiduce at gmail dot com [this message]
2024-02-05 17:27 ` [Bug fortran/110987] [13/14 Regression] " anlauf at gcc dot gnu.org
2024-02-05 17:34 ` anlauf at gcc dot gnu.org
2024-03-22 13:40 ` law at gcc dot gnu.org
2024-03-28 15:59 ` pault at gcc dot gnu.org
2024-03-29  7:23 ` cvs-commit at gcc dot gnu.org
2024-04-23  9:47 ` [Bug fortran/110987] [13 " pault at gcc dot gnu.org
2024-05-06  9:47 ` cvs-commit at gcc dot gnu.org
2024-05-06  9:50 ` pault at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-110987-4-AcJrPq7AQB@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).