From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 034873858CDA; Mon, 5 Feb 2024 15:54:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 034873858CDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1707148477; bh=rufTeYT1vJYoOH4oH/yxaDZEbZAIm6zVWTqchj1Vyf8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=E+2LNh4tlFz/bfnr8bUlArYwR7kpZyicMDkoNfWrj7XLBVmOpzvFvgT8sBrMF2mP6 9jZ81V11ArOjMcTpahpPZm41VZ/CgbDnX78sYDeXqp+wGN9YaQFTHtt4NcJDNJFVPk wcjQFBTTLeO59rq3ptseRm/xhlL4jBxehZ6wTNic= From: "jhaiduce at gmail dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 13.2.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jhaiduce at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110987 --- Comment #6 from John Haiducek --- 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 t= est: - 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-a= n-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 stateme= nt added to the end of the code did not produce any output) The program also reportedly runs as expected when compiled with ifort.=