https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92311
Bug ID: 92311 Summary: Fortran and OpenMP use_device_ptr and OpenACC attach_ptr/dettach_ptr Product: gcc Version: 9.2.0 Status: UNCONFIRMED Keywords: openacc, openmp Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: naromero at anl dot gov CC: jakub at gcc dot gnu.org Target Milestone: --- Host: x86-64 westmere Target: NVidia GPU Build: x86_64-pc-linux-gnu Created attachment 47152 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47152&action=edit Test OpenMP use_device_ptr and OpenACC dettach/attach I attach a simple isolated reproducer that reproduces the issue from a more complicated scientific code. The attached file contains both an OpenACC and OpenMP version of the same program. The OpenACC program build and runs correctly with the latest PGI Fortran compiler. The OpenMP program also builds and runs with the latest IBM XL Fortran compiler. The bug is against the frontend of the Fortran compiler that handles directives in both OpenACC and OpenMP for NVidia GPUs. Here is the compile-time error with -fopenmp: The error for the OpenMP is shown below: 29 | !$omp target data use_device_ptr(this_bin) | 1 Error: TARGET DATA must contain at least one MAP clause at (1) AFAIK, this is not a correct interpretation of the standard. You don't need a map clause here, use_device_ptr clause is enough. https://www.openmp.org/spec-html/5.0/openmpsu57.html#x83-2580002.12.2 For the OpenACC program, it may be that this is part of the OpenACC spec that has not been implemented yet. Here is the error with -fopenacc: test_openacc_attach.F90:27:9: 27 | !$acc enter data attach(this_bin) | 1 Error: Unclassifiable OpenACC directive at (1) test_openacc_attach.F90:46:9: 46 | !$acc exit data detach(this_bin) | 1 Error: Unclassifiable OpenACC directive at (1)