https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109646
Bug ID: 109646
Summary: OpenACC attach directive fails with "pointer target
not mapped for attach"
Product: gcc
Version: 12.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libgomp
Assignee: unassigned at gcc dot gnu.org
Reporter: [email protected]
CC: jakub at gcc dot gnu.org
Target Milestone: ---
Created attachment 54940
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54940&action=edit
Small test case to reproduce the problem
Using GNU Fortran (GCC) 12.2.1 20230302 [OG12] in OpenACC offloading.
the "!$acc enter data attach" directive fails with the message "libgomp:
pointer target not mapped for attach"
A small test-case is provide.
Compilation: gfortran -g -fopenacc tranform.f90 -o transform
Execution:
./transform
In add_new_transform for [Premiere]
In add_new_transform : [Premiere] is the first transform
In add_new_transform done for [Premiere]
In add_new_transform for [Seconde]
In add_new_transform insert [Seconde] after [Premiere]
libgomp: pointer target not mapped for attach
Test runs fine with nvfortran 22.5 (nvfortran -acc -g tranform.f90 -o
transform)
Test runs fine with Cray Fortran 15.0.1 (ftn -hacc -g tranform.f90 -o
transform)
Correct poutput is:
In add_new_transform for [Premiere]
In add_new_transform : [Premiere] is the first transform
In add_new_transform done for [Premiere]
In add_new_transform for [Seconde]
In add_new_transform insert [Seconde] after [Premiere]
In add_new_transform done for [Seconde]
Found 2
Stack size of the call giving the error:
Thread 1 "transform" hit Breakpoint 2, gomp_attach_pointer
(devicep=devicep@entry=0x634120, aq=aq@entry=0x0,
mem_map=mem_map@entry=0x634208, n=n@entry=0xb96cc0, attach_to=12150352,
bias=<optimized out>, cbufp=0x0,
allow_zero_length_array_sections=false) at
../../../gcc/libgomp/target.c:1012
1012 gomp_fatal ("pointer target not mapped for attach");
(gdb) where
#0 gomp_attach_pointer (devicep=devicep@entry=0x634120, aq=aq@entry=0x0,
mem_map=mem_map@entry=0x634208,
n=n@entry=0xb96cc0, attach_to=12150352, bias=<optimized out>, cbufp=0x0,
allow_zero_length_array_sections=false)
at ../../../gcc/libgomp/target.c:1012
#1 0x00007ffff736c007 in goacc_enter_data_internal (aq=<optimized out>,
kinds=<optimized out>, sizes=<optimized out>,
hostaddrs=0x7fffffffcc70, mapnum=<optimized out>, acc_dev=<optimized out>)
at ../../../gcc/libgomp/oacc-mem.c:1217
#2 goacc_enter_exit_data_internal (flags_m=<optimized out>, mapnum=<optimized
out>, hostaddrs=0x7fffffffcc70,
sizes=<optimized out>, kinds=<optimized out>,
data_enter=data_enter@entry=true, async=<optimized out>,
num_waits=<optimized out>, ap=<optimized out>) at
../../../gcc/libgomp/oacc-mem.c:1534
#3 0x00007ffff736cc0c in GOACC_enter_data (flags_m=<optimized out>,
mapnum=<optimized out>,
hostaddrs=<optimized out>, sizes=<optimized out>, kinds=<optimized out>,
async=<optimized out>, num_waits=0)
at ../../../gcc/libgomp/oacc-mem.c:1607
#4 0x000000000040148f in transforms_defs_m::add_new_transform
(transform=0x606a20, name=...,
new_ptr=<error reading variable: Cannot access memory at address 0x0>,
_name=7) at tranform.f90:87
#5 0x0000000000401698 in MAIN__ () at tranform.f90:138