From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 02A60384B0C1; Tue, 21 Apr 2020 12:36:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 02A60384B0C1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1587472561; bh=JMH+OvAnI2ekw7SihIZX4NmROz8opFj1IEpZHdHY/Ao=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Am+SWAfTKBS6lT+MXGWmJlLNCONitH08ay1qkEhU/0ntEUF8FasNRBagsRGD4U86D qnb6gsuzSQELzXRfdyoPXNKFatnGinckF0VWpNYA6NSD9F2UT1+pMTMmWCqAKnWHTj n1rT2VFQ7V3bhVZ+QY4u9phT0/cHHNdreE98+Z2s= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: =?UTF-8?B?W0J1ZyBmb3J0cmFuLzk0NjcyXSBbMTAgUmVncmVzc2lvbl0gZ2Zv?= =?UTF-8?B?cnRyYW4vT3Blbk1QIGNob2tlcyBvbiBQUkVTRU5UKGFycmF5KSBkZXNwaXRl?= =?UTF-8?B?IG9mIFNIQVJFRChhcnJheSk6IEVycm9yOiDigJhhcnJheeKAmSBub3Qgc3Bl?= =?UTF-8?B?Y2lmaWVkIGluIGVuY2xvc2luZyDigJhwYXJhbGxlbOKAmQ==?= Date: Tue, 21 Apr 2020 12:36: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: 10.0 X-Bugzilla-Keywords: openmp X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub 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: 10.0 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: Tue, 21 Apr 2020 12:36:01 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94672 --- Comment #5 from Jakub Jelinek --- Further examples, one for which should be rejected: subroutine s1 (array) real, optional :: array(:) !$omp parallel default(none) ! { dg-error "" } if (.not.present (array)) stop 1 ! { dg-error "" } !$omp end parallel end subroutine subroutine s2 (arg) real, optional :: arg !$omp parallel default(none) ! { dg-error "" } if (.not.present (arg)) stop 1 ! { dg-error "" } !$omp end parallel end subroutine subroutine s3 (arg) real, value, optional :: arg !$omp parallel default(none) ! { dg-error "" } if (.not.present (arg)) stop 1 ! { dg-error "" } !$omp end parallel end subroutine and one that should be accepted: subroutine s1 (array) real, optional :: array(:) !$omp parallel default(none) firstprivate (array) if (present (array)) array(:) =3D 3 !$omp end parallel end subroutine subroutine s2 (array) real, optional :: array(:) !$omp parallel default(none) shared (array) !$omp master if (present (array)) array(:) =3D 3 !$omp end master !$omp end parallel end subroutine subroutine s3 (array) real, optional :: array(:) !$omp parallel default(none) private (array) if (present (array)) array(:) =3D 3 !$omp end parallel end subroutine subroutine s4 (arg) real, optional :: arg !$omp parallel default(none) firstprivate (arg) if (present (arg)) arg =3D 3 !$omp end parallel end subroutine subroutine s5 (arg) real, optional :: arg !$omp parallel default(none) shared (arg) !$omp master if (present (arg)) arg =3D 3 !$omp end master !$omp end parallel end subroutine subroutine s6 (arg) real, optional :: arg !$omp parallel default(none) private (arg) if (present (arg)) arg =3D 3 !$omp end parallel end subroutine subroutine s7 (arg) real, value, optional :: arg !$omp parallel default(none) firstprivate (arg) if (present (arg)) arg =3D 3 !$omp end parallel end subroutine subroutine s8 (arg) real, value, optional :: arg !$omp parallel default(none) shared (arg) !$omp master if (present (arg)) arg =3D 3 !$omp end master !$omp end parallel end subroutine subroutine s9 (arg) real, value, optional :: arg !$omp parallel default(none) private (arg) if (present (arg)) arg =3D 3 !$omp end parallel end subroutine etc. Note, even just adding the artificial firstprivate clause is not enoug= h, the data sharing on the OPTIONAL parameters doesn't work as the standard sa= ys so. E.g. for private clause on OPTIONAL scalar without VALUE, we set the privat= ized arg to &arg.1 and then compare that in the present check against NULL (whic= h it always is). The spec says: "If a list item that appears in a directive or clause is an optional dummy argument that is not present, the directive or clause for that list item is ignored. If the variable referenced inside a construct is an optional dummy argument that is not present, any explicitly determined, implicitly determined, or predetermined data-sharing and data-mapping attribute rules for that variab= le are ignored. Otherwise, if the variable is an optional dummy argument that = is present, it is present inside the construct."=