public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/94672] [10 Regression] gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’ Date: Tue, 21 Apr 2020 12:36:00 +0000 [thread overview] Message-ID: <bug-94672-4-ssMc60qffn@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-94672-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94672 --- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> --- 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(:) = 3 !$omp end parallel end subroutine subroutine s2 (array) real, optional :: array(:) !$omp parallel default(none) shared (array) !$omp master if (present (array)) array(:) = 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(:) = 3 !$omp end parallel end subroutine subroutine s4 (arg) real, optional :: arg !$omp parallel default(none) firstprivate (arg) if (present (arg)) arg = 3 !$omp end parallel end subroutine subroutine s5 (arg) real, optional :: arg !$omp parallel default(none) shared (arg) !$omp master if (present (arg)) arg = 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 = 3 !$omp end parallel end subroutine subroutine s7 (arg) real, value, optional :: arg !$omp parallel default(none) firstprivate (arg) if (present (arg)) arg = 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 = 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 = 3 !$omp end parallel end subroutine etc. Note, even just adding the artificial firstprivate clause is not enough, the data sharing on the OPTIONAL parameters doesn't work as the standard says so. E.g. for private clause on OPTIONAL scalar without VALUE, we set the privatized arg to &arg.1 and then compare that in the present check against NULL (which 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 variable are ignored. Otherwise, if the variable is an optional dummy argument that is present, it is present inside the construct."
next prev parent reply other threads:[~2020-04-21 12:36 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-04-20 14:04 [Bug fortran/94672] New: " gcc at abeckmann dot de 2020-04-20 14:34 ` [Bug fortran/94672] [10 Regression] " jakub at gcc dot gnu.org 2020-04-20 14:54 ` jakub at gcc dot gnu.org 2020-04-20 15:12 ` jakub at gcc dot gnu.org 2020-04-21 11:55 ` jakub at gcc dot gnu.org 2020-04-21 12:36 ` jakub at gcc dot gnu.org [this message] 2020-05-07 10:04 ` [Bug fortran/94672] [10/11 " tschwinge at gcc dot gnu.org 2020-05-07 11:56 ` jakub at gcc dot gnu.org 2020-05-11 14:40 ` cvs-commit at gcc dot gnu.org 2020-05-12 10:08 ` cvs-commit at gcc dot gnu.org 2020-05-12 10:09 ` burnus at gcc dot gnu.org 2020-07-22 6:58 ` jakub at gcc dot gnu.org 2020-08-26 11:06 ` trnka at scm dot com 2020-08-28 11:54 ` cvs-commit at gcc dot gnu.org 2020-08-31 6:17 ` cvs-commit at gcc dot gnu.org 2020-08-31 6:50 ` burnus at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-94672-4-ssMc60qffn@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).