aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKwok Cheung Yeung <kcy@codesourcery.com>2019-05-03 06:14:35 -0700
committerThomas Schwinge <thomas@codesourcery.com>2020-03-03 12:17:23 +0100
commit22787bfbae73e999484b14db20893391a3db22ed (patch)
tree1736905386972d145aa8711c54144a150203d6ad
parent0f628705a3627299c255d605d6b38d2b7f2157a3 (diff)
downloadgcc-22787bfbae73e999484b14db20893391a3db22ed.zip
gcc-22787bfbae73e999484b14db20893391a3db22ed.tar.gz
gcc-22787bfbae73e999484b14db20893391a3db22ed.tar.bz2
Fix ICE when optional arguments are used in OpenACC directives
2019-05-03 Kwok Cheung Yeung <kcy@codesourcery.com> gcc/ * gimplify.c (gomp_oacc_needs_data_present): Return NULL if decl is a Fortran optional argument. (cherry picked from openacc-gcc-9-branch commit 9f8245e675d2907ae7b76a50557452361e979c59)
-rw-r--r--gcc/ChangeLog.omp5
-rw-r--r--gcc/gimplify.c3
2 files changed, 8 insertions, 0 deletions
diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp
index 6ec668e..1bf6dbc 100644
--- a/gcc/ChangeLog.omp
+++ b/gcc/ChangeLog.omp
@@ -1,3 +1,8 @@
+2019-05-03 Kwok Cheung Yeung <kcy@codesourcery.com>
+
+ * gimplify.c (gomp_oacc_needs_data_present): Return NULL if decl is a
+ Fortran optional argument.
+
2019-02-01 Thomas Schwinge <thomas@codesourcery.com>
* omp-oacc-kernels.c (struct adjust_nested_loop_clauses_wi_info): New.
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index f7cfa0e..dfd3173 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -9707,6 +9707,9 @@ gomp_oacc_needs_data_present (tree decl)
|| TREE_CODE (TREE_TYPE (TREE_TYPE (decl))) != ARRAY_TYPE))
return NULL;
+ if (omp_is_optional_argument (decl))
+ return NULL;
+
decl = get_base_address (decl);
for (ctx = gimplify_omp_ctxp->outer_context; ctx; ctx = ctx->outer_context)