From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A782D3858D1E; Tue, 16 Jan 2024 21:05:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A782D3858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705439101; bh=0jy71tWSLWJNR8g6rcvmZZ9h0vGt5zke9yVVQCaQSq0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=rg9IazcwHMOPad5YjKJllOqENg9ZnZtEhlV4IXKc+jdRXziPte2MEQ/vYyb0+YD/c eUR2bvYF8lVPNTbYynUOMIzaW+l5JAAbBh2Dk81VQLyw3GY2JFNXveU0HhhX9TErxz SDDezHufqUW0VkcJdqH2kBVFUuLypokjEo/bj5ZY= From: "anlauf at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/113377] Wrong code passing optional dummy argument to elemental procedure with optional dummy Date: Tue, 16 Jan 2024 21:05:00 +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: 14.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: anlauf at gcc dot gnu.org 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: attachments.created 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=3D113377 --- Comment #3 from anlauf at gcc dot gnu.org --- Created attachment 57108 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D57108&action=3Dedit Patch to play with This is a first attempt to outline code for handling scalar dummies with the VALUE attribute. This fixes the following variants of the declaration of dummy argument j in function one: integer, value, optional :: j integer, intent(in), optional :: j integer, intent(in), optional :: j(4) integer, intent(in), optional :: j(:) However, integer, allocatable,optional :: j still does not work: the code *in* the generated loop looks fine to me, but the scalarizer dereferences j before the loop. I think that this is correct F2018+, as ifx handles it fine. Not sure how to proceed here. Furthermore, the patch tries to cope (=3D prevent an ICE) with integer, allocatable,optional :: j(:) which I think might be invalid. At least it also crashed with ifx... Otherwise, the patch so far regtests ok.=