From: Kwok Cheung Yeung Date: Fri, 3 May 2019 13:14:35 +0000 (-0700) Subject: Fix ICE when optional arguments are used in OpenACC directives X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22787bfbae73e999484b14db20893391a3db22ed;p=thirdparty%2Fgcc.git Fix ICE when optional arguments are used in OpenACC directives 2019-05-03 Kwok Cheung Yeung 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) --- diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp index 6ec668e2ebe4..1bf6dbcb8c71 100644 --- a/gcc/ChangeLog.omp +++ b/gcc/ChangeLog.omp @@ -1,3 +1,8 @@ +2019-05-03 Kwok Cheung Yeung + + * gimplify.c (gomp_oacc_needs_data_present): Return NULL if decl is a + Fortran optional argument. + 2019-02-01 Thomas Schwinge * omp-oacc-kernels.c (struct adjust_nested_loop_clauses_wi_info): New. diff --git a/gcc/gimplify.c b/gcc/gimplify.c index f7cfa0eb4e1e..dfd317358631 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)