https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108624
Bug ID: 108624
Summary: [OpenMP] Map(ptr, ptr[2:N-2]) will cause a segfault,
'map(ptr, ptr[0:N])'
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Keywords: openmp, wrong-code
Severity: normal
Priority: P3
Component: libgomp
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
CC: jakub at gcc dot gnu.org
Target Milestone: ---
Created attachment 54382
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54382&action=edit
Testcase doing map(ptr1[1:N-1]) - segfaulting at runtime when doing offload
This came up during the OpenMP F2F and the segfaults at runtime both with GCC
and Clang,
It is based on
https://github.com/OpenMP/Examples/blob/main/devices/sources/target_ptr_map.1.c
- And we believe the modified variant should work (but I have not fully checked
whether it is indeed supposed to work).
The problem seems to be that
ptr maps the pointer
ptr[n:m] maps the array
Without 'ptr', it is attached and firstprivatized - that just works fine.
With 'ptr' being present in addition, with
ptr[0:m] (i.e. starting at the lowest index)
the pointer attach of the data to the 'ptr' workes.
However, if one starts with
ptr[2:N-2] (i.e. with offset)
the pointer attachment does not work - leading to a segfault at runtime.
Naming remark:
For map(ptr[2:N-2]),
ptr[2] is in the mapped range
while p[0] is in the extended range.