From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2C6AE398E45F; Fri, 19 Feb 2021 20:13:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2C6AE398E45F From: "anlauf at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/99169] [9/10/11 Regression] Segfault when passing allocatable scalar into intent(out) dummy argument Date: Fri, 19 Feb 2021 20:13:21 +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: 10.2.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: anlauf at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 9.4 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 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 20:13:22 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99169 --- Comment #3 from anlauf at gcc dot gnu.org --- A conservative solution simply disables the clobber: diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 103cb31c664..ce7bfaa89e8 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -6082,6 +6084,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sy= m, /* FIXME - PR 87395 and PR 41453 */ && e->symtree->n.sym->attr.save =3D=3D SAVE_NONE && !e->symtree->n.sym->attr.associate_var + && !e->symtree->n.sym->attr.allocatable && e->ts.type !=3D BT_CHARACTER && e->ts.type !=3D BT_DERIVED && e->ts.type !=3D BT_CLASS && !sym->attr.elemental; This should result only in a missed optimization. Is there a way to get sth. like: *i =3D {CLOBBER}; so that we do not clobber the pointer but the pointer to?=