https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88939
Bug ID: 88939 Summary: [nvptx, openacc, libgomp] Assertion `!s->map->active' failed for synchronous parallel with abort Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: vries at gcc dot gnu.org Target Milestone: --- Atm, abort-1.c passes like this: ... CheCKpOInT libgomp: cuStreamSynchronize error: an illegal instruction was encountered abort-1.exe: /libgomp/plugin/plugin-nvptx.c:271: map_fini: \ Assertion `!s->map->active' failed. PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/abort-1.c \ -DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 -O0 execution test ... The usual scenario in nvptx_exec for synchronous kernel launches is this sequence of calls: - map_push, allocating a device memory pointer for the kernel arguments, and allocating a struct cuda_map (to keep track of the device pointer), setting the active field of struct cuda_map to true - cuLaunchKernel, launching a kernel on a CUDA stream - cuStreamSynchronize, waiting till the stream task (i.e, the kernel) completes - map_pop, freeing the device memory and the corresponding struct cuda_map In the case of this test-case, the abort causes cuStreamSynchronize to return CUDA_ERROR_ILLEGAL_INSTRUCTION, which is then handled using a GOMP_PLUGIN_fatal call, which calls abort. This means map_pop is not called, so no memory is freed. Then during fini_streams_for_device, map_fini is called, the remaining map is found, and the !s->map->active assert triggers.