diff options
author | Tobias Burnus <tobias@codesourcery.com> | 2020-01-04 08:19:51 +0000 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2020-01-04 09:19:51 +0100 |
commit | 9b9623194bf17328bc03e09b043149adf4fb0f9a (patch) | |
tree | 1247970c3e2684bee6845dcbdeb5ee4a097181db /gcc/fortran/trans-expr.c | |
parent | c0c4eaae49682e8026e1f42087f58e22d2d5c294 (diff) | |
download | gcc-9b9623194bf17328bc03e09b043149adf4fb0f9a.zip gcc-9b9623194bf17328bc03e09b043149adf4fb0f9a.tar.gz gcc-9b9623194bf17328bc03e09b043149adf4fb0f9a.tar.bz2 |
Fortran] PR91640 – Fix call to contiguous dummy
PR fortran/91640
* trans-expr.c (gfc_conv_procedure_call): Avoid copy-out for nonvariable
arguments to contiguous dummy args. Avoid re-checking whether fsym is
NULL.
PR fortran/91640
* gfortran.dg/contiguous_10.f90: New.
From-SVN: r279879
Diffstat (limited to 'gcc/fortran/trans-expr.c')
-rw-r--r-- | gcc/fortran/trans-expr.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index f2fe538..e1c0fb2 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -6178,7 +6178,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym, fsym && fsym->attr.pointer); else if (gfc_is_class_array_ref (e, NULL) - && fsym && fsym->ts.type == BT_DERIVED) + && fsym && fsym->ts.type == BT_DERIVED) /* The actual argument is a component reference to an array of derived types. In this case, the argument is converted to a temporary, which is passed and then @@ -6187,26 +6187,26 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym, the same as the declared type, copy-in/copy-out does not occur. */ gfc_conv_subref_array_arg (&parmse, e, nodesc_arg, - fsym ? fsym->attr.intent : INTENT_INOUT, - fsym && fsym->attr.pointer); + fsym->attr.intent, + fsym->attr.pointer); else if (gfc_is_class_array_function (e) - && fsym && fsym->ts.type == BT_DERIVED) + && fsym && fsym->ts.type == BT_DERIVED) /* See previous comment. For function actual argument, the write out is not needed so the intent is set as intent in. */ { e->must_finalize = 1; gfc_conv_subref_array_arg (&parmse, e, nodesc_arg, - INTENT_IN, - fsym && fsym->attr.pointer); + INTENT_IN, fsym->attr.pointer); } else if (fsym && fsym->attr.contiguous - && !gfc_is_simply_contiguous (e, false, true)) + && !gfc_is_simply_contiguous (e, false, true) + && gfc_expr_is_variable (e)) { gfc_conv_subref_array_arg (&parmse, e, nodesc_arg, - fsym ? fsym->attr.intent : INTENT_INOUT, - fsym && fsym->attr.pointer); + fsym->attr.intent, + fsym->attr.pointer); } else gfc_conv_array_parameter (&parmse, e, nodesc_arg, fsym, |