public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/104949] New: [OpenMP] omp target: firstprivate of allocatable array – only descriptor firstprivatized
Date: Wed, 16 Mar 2022 08:45:46 +0000	[thread overview]
Message-ID: <bug-104949-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104949

            Bug ID: 104949
           Summary: [OpenMP] omp target: firstprivate of allocatable array
                    – only descriptor firstprivatized
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: openmp, wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
  Target Milestone: ---

Found via
https://github.com/SOLLVE/sollve_vv/blob/master/tests/5.0/target/test_target_defaultmap_firstprivate.F90

The line:
  !$omp target firstprivate(A)

is translated as

        .omp_data_arr.19.a = &a;
        #pragma omp target num_teams(1) thread_limit(0) firstprivate(a)
               [child fn: MAIN__._omp_fn.1 (.omp_data_arr.19,
.omp_data_sizes.20,
                                            .omp_data_kinds.21)]

Thus, it does not handle the descriptor. See also PR 90742.

 * * *

implicit none (type,external)
integer, allocatable :: A(:)
A = [1,2,3,4,5,6]

!$omp parallel firstprivate(A)
!$omp master
  if (any (A /= [1,2,3,4,5])) error stop
  A(:) = [99,88,77,66,55]
!$omp end master
!$omp end parallel

!$omp target firstprivate(A)
  if (any (A /= [1,2,3,4,5])) error stop
  A(:) = [99,88,77,66,55]
!$omp end target
if (any (A /= [1,2,3,4,5])) error stop
end

             reply	other threads:[~2022-03-16  8:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-16  8:45 burnus at gcc dot gnu.org [this message]
2022-03-31 18:12 ` [Bug fortran/104949] " burnus at gcc dot gnu.org
2022-05-23  8:54 ` cvs-commit at gcc dot gnu.org
2022-05-23 10:05 ` burnus at gcc dot gnu.org
2023-03-24 16:16 ` cvs-commit 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-104949-4@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: link
Be 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).