[PATCH 1/4] [og8] Allow NULL for update directives in OpenACC 2.6
Kwok Cheung Yeung
kcy@codesourcery.com
Wed Jan 30 22:22:00 GMT 2019
A non-present passed-by-reference Fortran optional argument is
represented by a null pointer. When passed to an update directive, it
should be ignored as variable mappings are not created for null
pointers. This should be safe as it is not possible to change a
non-present argument into a present one (or vice-versa) in Fortran.
libgomp/
* oacc-mem.c (update_dev_host): Return early if the host address
is NULL.
Reviewed-by: Julian Brown <julian@codesourcery.com>
Reviewed-by: Thomas Schwinge <thomas@codesourcery.com>
---
libgomp/ChangeLog.openacc | 5 +++++
libgomp/oacc-mem.c | 6 ++++++
2 files changed, 11 insertions(+)
diff --git a/libgomp/ChangeLog.openacc b/libgomp/ChangeLog.openacc
index a9a30d2..69bd1ee 100644
--- a/libgomp/ChangeLog.openacc
+++ b/libgomp/ChangeLog.openacc
@@ -1,3 +1,8 @@
+2019-01-30 Kwok Cheung Yeung <kcy@codesourcery.com>
+
+ * oacc-mem.c (update_dev_host): Return early if the host address
+ is NULL.
+
2019-01-30 Andrew Jenner <andrew@codesourcery.com>
* testsuite/libgomp.fortan/fortran.exp (lang_link_flags): Add
diff --git a/libgomp/oacc-mem.c b/libgomp/oacc-mem.c
index 9b70820..74d7ce9 100644
--- a/libgomp/oacc-mem.c
+++ b/libgomp/oacc-mem.c
@@ -819,6 +819,12 @@ update_dev_host (int is_dev, void *h, size_t s, int
async)
if (acc_dev->capabilities & GOMP_OFFLOAD_CAP_SHARED_MEM)
return;
+ /* Fortran optional arguments that are non-present result in a
+ null host address here. This can safely be ignored as it is
+ not possible to 'update' a non-present optional argument. */
+ if (h == NULL)
+ return;
+
gomp_mutex_lock (&acc_dev->lock);
acc_prof_info prof_info;
--
2.8.1
More information about the Gcc-patches
mailing list