https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66089
--- Comment #1 from Mikael Morin <mikael at gcc dot gnu.org> --- Draft patch: Index: trans-array.c =================================================================== --- trans-array.c (révision 222968) +++ trans-array.c (copie de travail) @@ -2449,13 +2449,6 @@ gfc_scalar_elemental_arg_saved_as_reference (gfc_s && ss_info->expr->ts.type == BT_CLASS) return true; - /* If the expression is a data reference of aggregate type, - avoid a copy by saving a reference to the content. */ - if (ss_info->expr->expr_type == EXPR_VARIABLE - && (ss_info->expr->ts.type == BT_DERIVED - || ss_info->expr->ts.type == BT_CLASS)) - return true; - /* Otherwise the expression is evaluated to a temporary variable before the scalarization loop. */ return false;