public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/109831] New: [OpenMP] Handle absent optional arguments in depend, has_device_addr, to/from and allocatable/pointer vars in map
@ 2023-05-12 14:23 burnus at gcc dot gnu.org
  0 siblings, 0 replies; only message in thread
From: burnus at gcc dot gnu.org @ 2023-05-12 14:23 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109831
           Summary: [OpenMP] Handle absent optional arguments in depend,
                    has_device_addr, to/from and allocatable/pointer vars
                    in map
           Product: gcc
           Version: 13.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: ---

ISSUE 1: allocatated/associated vs. present cannot be distinguished for scalar
allocatables/pointers, i.e.

subroutine foo(x)
  integer, allocatable, optional :: x
  !$omp target
     if (.not.present(x))
       print *, "not present"
     else if (.not. allocated(x)) then 
       print *, "not allocated"
     else
       print *, "value: ", x
     end if
  !$omp end target
end

Does not work correctly as we pass 'x == NULL ? NULL : *x' as argument
to the map. We should map *x (if present) and a pointer variable to which we
attach the *x pointer.


ISSUE 2: Extend the set of permitted clauses.

Absent optionals are permitted for some other clauses besides 'map'. Per
post-TR11 discussions (→ OpenMP Spec issue #3490), there are *not* permitted
...

* ... for variables that are evaluated in a clause such as 'if(...)'
* ... for variables that are privatized ('firstprivate', 'private',
'is_device_ptr')
* ... at places where the clause poses restrictions that can only be fulfilled
when the variable is present – like 'copyprivate' (argument must be privatized,
hence, it has to exist)

Besides 'map', that's the case for
* the 'to'/from' motion clauses
* has_device_addr
* depend
* < something else ? >

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-12 14:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-12 14:23 [Bug fortran/109831] New: [OpenMP] Handle absent optional arguments in depend, has_device_addr, to/from and allocatable/pointer vars in map burnus at gcc dot gnu.org

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).