From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 13665394EC3D; Fri, 19 Feb 2021 17:31:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 13665394EC3D From: "townsend at astro dot wisc.edu" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/99169] New: Segfault when passing allocatable scalar into intent(out) dummy argument Date: Fri, 19 Feb 2021 17:31:45 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 10.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: townsend at astro dot wisc.edu X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 17:31:46 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99169 Bug ID: 99169 Summary: Segfault when passing allocatable scalar into intent(out) dummy argument Product: gcc Version: 10.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: townsend at astro dot wisc.edu Target Milestone: --- Created attachment 50222 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D50222&action=3Dedit Minimal working example I've encountered a problem when passing an allocatable (and alread allocate= d) scalar as an actual argument to a procedure with an intent(out) (but not allocatable) dummy argument. The attached code illustrates the problem.=20 Compiling with gfortran 10.2.0 at optimization level -O1 or -O2 leads to a segmentation fault at runtime. The segfault arises when the dummy is assign= ed within set_i(). This problem does not arise at optimization level -O0, and = the program performs as expected (outputting '5' to the terminal). The problem also seems to disappear when set_i() is a CONTAINed procedure in the main program, rather than a module procedure. cheers, Rich=