diff options
author | Tom de Vries <tdevries@suse.de> | 2019-01-23 08:16:56 +0000 |
---|---|---|
committer | Tom de Vries <vries@gcc.gnu.org> | 2019-01-23 08:16:56 +0000 |
commit | 4a75460b0099618b2d79ffda615a9516dcd5c224 (patch) | |
tree | 2596f989d134272b77a51936fc8e04458455975c /gcc | |
parent | 4fef8e4d8c8901db0fa21c4d49b7a851bff4ac9a (diff) | |
download | gcc-4a75460b0099618b2d79ffda615a9516dcd5c224.zip gcc-4a75460b0099618b2d79ffda615a9516dcd5c224.tar.gz gcc-4a75460b0099618b2d79ffda615a9516dcd5c224.tar.bz2 |
[nvptx, libgomp] Fix cuMemAlloc with size zero
Consider test-case:
...
int
main (void)
{
#pragma acc parallel async
;
#pragma acc parallel async
;
#pragma acc wait
return 0;
}
...
This fails with:
...
libgomp: cuMemAlloc error: invalid argument
Segmentation fault (core dumped)
...
The cuMemAlloc error is due to the fact that we're try to allocate 0 bytes.
Fix this by preventing calling map_push with size zero argument in nvptx_exec.
This also has the consequence that for the abort-1.c test-case, we end up
calling cuMemFree during map_fini for the struct cuda_map allocated in
map_init, which fails because an abort happened. Fix this by calling
cuMemFree with CUDA_CALL_NOCHECK in cuda_map_destroy.
2019-01-23 Tom de Vries <tdevries@suse.de>
PR target/PR88946
* plugin/plugin-nvptx.c (cuda_map_destroy): Use CUDA_CALL_NOCHECK for
cuMemFree.
(nvptx_exec): Don't call map_push if mapnum == 0.
* testsuite/libgomp.oacc-c-c++-common/pr88946.c: New test.
From-SVN: r268178
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions