Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/2222646/?format=api
{ "id": 2222646, "url": "http://patchwork.ozlabs.org/api/1.2/patches/2222646/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/CAGkQGi+sg7_JsVAith_3XhW8Dm2UdDZQgcBXsbCJtD2y4+ojyw@mail.gmail.com/", "project": { "id": 17, "url": "http://patchwork.ozlabs.org/api/1.2/projects/17/?format=api", "name": "GNU Compiler Collection", "link_name": "gcc", "list_id": "gcc-patches.gcc.gnu.org", "list_email": "gcc-patches@gcc.gnu.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<CAGkQGi+sg7_JsVAith_3XhW8Dm2UdDZQgcBXsbCJtD2y4+ojyw@mail.gmail.com>", "list_archive_url": null, "date": "2026-04-13T09:21:10", "name": "[fortran] PR120140 - generic type-bound procedure, defined assignment, and subarray reference", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "b476e4b58d8b8ed0b007d7cdd3f59e8091d501bf", "submitter": { "id": 4392, "url": "http://patchwork.ozlabs.org/api/1.2/people/4392/?format=api", "name": "Paul Richard Thomas", "email": "paul.richard.thomas@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/CAGkQGi+sg7_JsVAith_3XhW8Dm2UdDZQgcBXsbCJtD2y4+ojyw@mail.gmail.com/mbox/", "series": [ { "id": 499673, "url": "http://patchwork.ozlabs.org/api/1.2/series/499673/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=499673", "date": "2026-04-13T09:21:10", "name": "[fortran] PR120140 - generic type-bound procedure, defined assignment, and subarray reference", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/499673/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2222646/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2222646/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "gcc-patches@gcc.gnu.org" ], "Delivered-To": [ "patchwork-incoming@legolas.ozlabs.org", "gcc-patches@gcc.gnu.org" ], "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=D6t3rXZ0;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=2620:52:6:3111::32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)", "sourceware.org;\n\tdkim=pass (2048-bit key,\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=D6t3rXZ0", "sourceware.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com", "sourceware.org; spf=pass smtp.mailfrom=gmail.com", "server2.sourceware.org;\n arc=pass smtp.remote-ip=74.125.82.42" ], "Received": [ "from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fvMPM6wpkz1yDF\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 13 Apr 2026 19:22:14 +1000 (AEST)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 044BB4BA2E2F\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 13 Apr 2026 09:22:12 +0000 (GMT)", "from mail-dl1-f42.google.com (mail-dl1-f42.google.com\n [74.125.82.42])\n by sourceware.org (Postfix) with ESMTPS id 059E44BA2E09\n for <gcc-patches@gcc.gnu.org>; Mon, 13 Apr 2026 09:21:23 +0000 (GMT)", "by mail-dl1-f42.google.com with SMTP id\n a92af1059eb24-12713e56abdso2664002c88.1\n for <gcc-patches@gcc.gnu.org>; Mon, 13 Apr 2026 02:21:23 -0700 (PDT)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org 044BB4BA2E2F", "OpenDKIM Filter v2.11.0 sourceware.org 059E44BA2E09" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 059E44BA2E09", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 059E44BA2E09", "ARC-Seal": [ "i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1776072084; cv=pass;\n b=XlMHAHq7dgfK3fhna35U3GSxsTISFQQobPn511NJrhHWOtsMkx0g2diMjjnP8gsKY0TjY7p5r4I1jhVSddV/UausBFukVU1v6EUZVBJl11oBiwIJ3M4UHgVjUrddZZhh/dB3BzKg68gj7ITGkupvtqb8tKaf6tuxJuatP5dza08=", "i=1; a=rsa-sha256; t=1776072083; cv=none;\n d=google.com; s=arc-20240605;\n b=ikVIQQmcUJaqlTgjSfOC0iOi1tHiRiE1Z/orpnM5e6Vbdw/5XFmyIKA26Aq2AWtNc/\n ydKR6zwisQRMFPZIjZGr4pF/TMC9JDdvxdltm5UpCg9tPVmHhhpvhQDBm5th+fV2KW1K\n m36Z46IrnELojou+8GAb5PQajx80bZgX7crVs4gi6oDMhvXBU72uVVJHDqO6U0zrUiHX\n Rtt5Dhna0wViZFv0Lzab0uCG+XuVTc9nmkvsFa48Fr5x58t3TKCHZ14LXJ8IcR2eTeux\n vVzj3oPprwcLK1pDcnqnMeZEtofmml8whzLRVgVa/Yq5sFJgigxlT0HQHI+3/DarQoiK\n Eyzw==" ], "ARC-Message-Signature": [ "i=2; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776072084; c=relaxed/simple;\n bh=zbovVeIftGN29CsiY7137YcfW6kWsUJZSIxkGZHQvls=;\n h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To;\n b=b8KiaylUXy/9H8se87u2b3jFy9yMBEP8sXNJDvajHg6b3hw0wCETBK8+ndlpCZOD/GH74Y3X1gSspjIvs9TDDrJATYKNyMkjK+9modtS9C9oGfA/pzXegRQCo5wlP/r6y0o4A4ZqoznKEHuW4oRWqaBYLbFLMdBs//zaP/k5Ehs=", "i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n s=arc-20240605;\n h=cc:to:subject:message-id:date:from:mime-version:dkim-signature;\n bh=4dMk2uPfH7bYsjMc/gm76u00avPhK3eTYjb03+fyfTE=;\n fh=1hDOPcmyUF9kUG1EtUf4PuyxxoW6Uz6+RCBNJJZ4/A4=;\n b=BrFpZd+nDM4VgsE1Qb9CwZNdYADRDTnI10E1xAPzwGhLlU9ie76ZyuV07pfxRs4KoP\n F8P1Jv93pnO1ljM/nuINwOXWdOFiawIlTUuvLQ1VdjxmGes1A9Mo2/80XDx34yWBoEKW\n HvjZOcXSzG7KkfA1lX/bCydHEhzu3lskvpxsUL03tQj3GqWH6+/+3aRfiFotFlgZBIhm\n xkycDHOG2ymwUhiF7WPAKvGgNZg4esY4iQ557PXhE3z3BAMnxb5OgofGVz/cTO9XFUoh\n oTM6k1JwYqtjAiI9lIbGQCwdYe+3P57/nU/BFVaV04V4/dczYCEaUIMNPnrLnpv9DyxN\n z6rg==; darn=gcc.gnu.org" ], "ARC-Authentication-Results": [ "i=2; server2.sourceware.org", "i=1; mx.google.com; arc=none" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1776072083; x=1776676883; darn=gcc.gnu.org;\n h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject\n :date:message-id:reply-to;\n bh=4dMk2uPfH7bYsjMc/gm76u00avPhK3eTYjb03+fyfTE=;\n b=D6t3rXZ0mRRNsgXsUDlXTgoeBPfheI8ncpVW0I6nh7IrpZClXr6E6H8JaRY8mzZrpE\n c4q/4FNrkmBzl87sGXSlVS2QrcylvJkw3dM6DESUnq5emUOFnyXIiajxVH/E82PHo6TA\n XWqtRWEN8XAvjTyX3asaNT2gh3AoOM62wxW2RgNEMcuW/CH3YPrWGIfnOuBeVLQJggEM\n FLW74PENX1ow+7HBhXuwUg3ZCYc7lTYAVrvn/DqpZ4V4kArAuztig6ajFhrF837muzED\n hsXWybPHFCMA0XpHm/zvlNm+hav58RxscdQJ/hPyLLg+qTarhu6DvXOlqQS5g/6dT07P\n HO8w==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776072083; x=1776676883;\n h=cc:to:subject:message-id:date:from:mime-version:x-gm-gg\n :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;\n bh=4dMk2uPfH7bYsjMc/gm76u00avPhK3eTYjb03+fyfTE=;\n b=phvCcWyAffhaT1rzYvxlcOzNNI6Tw635lxDCpDPVzjWNcQY3ijaKqIcZvTX0bgDJeu\n uUYO+GY+cYMBRCNhkP+zvMdogXvdm3LmSVfgGleCdS9vks3juz8ooFBTQbyXv8nhFry3\n bl7m7ML/zqvcWa6WfMbj1RNzPT/OlbcBYN42sKqNoRKjGvcnIG6azw19h/BI6BOURIC9\n WihbVeqxAzqI5w6iqqKv0GL73bGYy4taOJdsTGGLqsbvus3sim76CMMiDLVgnWqLcfa6\n xtjKfi8tvKawXMrz47DyImQYZtbQm7LMXl9+QOpoNz3zwXIMWaSMkJRCgxZWHtFs1dj2\n GMgA==", "X-Forwarded-Encrypted": "i=1;\n AFNElJ+MfFGTFvtj/wPpis7SzkZHbVuA/vHF00KXuH/dIULOT0UlLr3aTvE45I6gUy8QJvzEX0W2Q6WZg7zgvQ==@gcc.gnu.org", "X-Gm-Message-State": "AOJu0YyZwXdXH+ysy5fCyJCcM1TI9m7RUUQmUWktCxt9JYd5WE2/uQEV\n VhCuzWPz+OuLTjvt3ywsvUw6ug/bFYgmPDtrnlJCauSp9D19znZnCP5ljm2DNCeMDVey/XBcPDh\n 8FIOMz/l/gxrpLXcuV5yDQbzHoasvxw8=", "X-Gm-Gg": "AeBDies/31RbzJn7k25ybYzN13tQ15zIfksVSbNpLNWlY8h/kt2pj2giWgbaRQHShU/\n 7OKuwUSOLFA0aBJe78rgX2LvCuPCJAPsvoDhrMgqaoa6+7EYndfb/wieIQm2qClQqTfSvLf1mdC\n pwrYp7FuQMg9l7kLHWbV9IPZE117OlmeB3+QZl7qCqLA7VVb3WLe/Z5GrfitE9J63HWGS06Bo2d\n hXWyq3Y3c9HqSgDlPOgHusnmA2kLsUvxSieee3dcrf1LVlwACV9T1l/xjE7m4d6CLKR9A4gwin2\n 2LBNNkjl2fIORdm3D5te5r8F+3Nr3LEnnEQ32JcoXQ==", "X-Received": "by 2002:a05:7022:6885:b0:12b:ebf6:a3bc with SMTP id\n a92af1059eb24-12c351a0d3amr5706657c88.3.1776072082610; Mon, 13 Apr 2026\n 02:21:22 -0700 (PDT)", "MIME-Version": "1.0", "From": "Paul Richard Thomas <paul.richard.thomas@gmail.com>", "Date": "Mon, 13 Apr 2026 10:21:10 +0100", "X-Gm-Features": "AQROBzDabNmpuTvrpDBth1qTosmu4PFNOc2tbIhAU9LbneDBi-FiBi63Sfdo1qw", "Message-ID": "\n <CAGkQGi+sg7_JsVAith_3XhW8Dm2UdDZQgcBXsbCJtD2y4+ojyw@mail.gmail.com>", "Subject": "[Patch, fortran] PR120140 - generic type-bound procedure, defined\n assignment, and subarray reference", "To": "\"fortran@gcc.gnu.org\" <fortran@gcc.gnu.org>,\n gcc-patches <gcc-patches@gcc.gnu.org>, Harald Anlauf <anlauf@gmx.de>", "Cc": "Jerry DeLisle <jvdelisle2@gmail.com>", "Content-Type": "multipart/mixed; boundary=\"00000000000094dba6064f5401b3\"", "X-BeenThere": "gcc-patches@gcc.gnu.org", "X-Mailman-Version": "2.1.30", "Precedence": "list", "List-Id": "Gcc-patches mailing list <gcc-patches.gcc.gnu.org>", "List-Unsubscribe": "<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>", "List-Archive": "<https://gcc.gnu.org/pipermail/gcc-patches/>", "List-Post": "<mailto:gcc-patches@gcc.gnu.org>", "List-Help": "<mailto:gcc-patches-request@gcc.gnu.org?subject=help>", "List-Subscribe": "<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>", "Errors-To": "gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org" }, "content": "Hello All,\n\nThe attached fixes the remaining dependency issues, where more than\none temporary is required for elemental subroutine calls. Extra tests\nare now enabled in defined_assignment_13.f90.\n\nSome of you have tested and commented on an earlier version of the\npatch, for which thanks are due. This submission is completely\nrefactored and simplified. Note also the condition that the extra\ntemporary should only correspond to INTENT_IN arguments. Using\nwrite-in and write-out for other intents would enable non-conforming\ncode because of the possibility of aliasing.\n\nRegtests OK on FC43/x86_64. OK for mainline?\n\nRegards\n\nPaul", "diff": "From a521d44a131d4b9a64c7fec5687e0c2b51f1c75b Mon Sep 17 00:00:00 2001\nFrom: Paul Thomas <pault@gcc.gnu.org>\nDate: Mon, 13 Apr 2026 09:50:42 +0100\nSubject: [PATCH] Fortran: Fix dependencies in elemental subroutine calls\n [PR120140]\n\nThis patch fixes situations in which more than one temporary is needed\nin elemental calls. Rather than increase complexity of the scalarizer,\nthe extra temporaries are conveniently generated in resolve.cc. Note\nthe requirement for the extra temporary to correspond to an INTENT_IN\nargument. This is done to avoid non-conforming code. If the user wishes\nto risk aliasing it is up to them! \n\n2026-04-13 Paul Thomas <pault@gcc.gnu.org>\n\ngcc/fortran\n\tPR fortran/120140\n\t* resolve.cc (resolve_elemental_dependencies): New function,\n\tpreceded by prototype for add_temp_assign_before_call.\n\t(resolve_call): If an elemental subroutine call has at least\n\ttwo actual erguments, call resolve_elemental_dependencies to\n\tgenerate temporary expressions for the arguments if required.\n\t(get_temp_from_expr): Add optional boolean argument, which if\n\tset, makes the resulting temporary unconditionally allocatable.\n\t(add_temp_assign_before_call): New function.\n\ngcc/testsuite/\n\tPR fortran/123352\n\t* gfortran.dg/defined_assignment_13.f90: Add previously failing\n\ttests.\n---\n gcc/fortran/resolve.cc | 105 +++++++++++++++++-\n .../gfortran.dg/defined_assignment_13.f90 | 44 +++++---\n 2 files changed, 130 insertions(+), 19 deletions(-)\n\ndiff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc\nindex eac6e81c233..f6cb8f157dd 100644\n--- a/gcc/fortran/resolve.cc\n+++ b/gcc/fortran/resolve.cc\n@@ -4129,6 +4129,55 @@ check_import_status (gfc_expr *e)\n }\n \n \n+/* If an elemental call has an INTENT_IN argument that has a dependency on an\n+ argument which is not INTENT_IN and requires a temporary, build a temporary\n+ for the INTENT_IN actual argument as well. */\n+\n+static void\n+add_temp_assign_before_call (gfc_code *, gfc_namespace *, gfc_expr **);\n+\n+static void\n+resolve_elemental_dependencies (gfc_code *c)\n+{\n+ gfc_actual_arglist *arg1 = c->ext.actual;\n+ gfc_actual_arglist *arg2 = NULL;\n+ gfc_formal_arglist *formal1 = c->resolved_sym->formal;\n+ gfc_formal_arglist *formal2 = NULL;\n+ gfc_expr *expr1;\n+ gfc_expr **expr2;\n+\n+ for (; arg1 && formal1; arg1 = arg1->next, formal1 = formal1->next)\n+ {\n+ if (formal1->sym\n+\t && (formal1->sym->attr.intent == INTENT_IN\n+\t || formal1->sym->attr.value))\n+\tcontinue;\n+\n+ if (!arg1->expr || arg1->expr->expr_type != EXPR_VARIABLE)\n+\tcontinue;\n+\n+ arg2 = c->ext.actual;\n+ formal2 = c->resolved_sym->formal;\n+ for (; arg2 && formal2; arg2 = arg2->next, formal2 = formal2->next)\n+\t{\n+\t if (arg2 == arg1 || !arg2->expr\n+\t || !(formal2->sym && formal2->sym->attr.intent == INTENT_IN))\n+\t continue;\n+\n+\t expr1 = arg1->expr;\n+\t expr2 = &arg2->expr;\n+\n+\t /* If the arg1 has something horrible like a vector index and\n+\t there is a dependency between arg1 and arg2, build a\n+\t temporary from arg2, assign the arg2 to it and use the\n+\t temporary in the call expression. */\n+\t if (expr1->rank && gfc_ref_needs_temporary_p (expr1->ref)\n+\t && gfc_check_dependency (expr1, *expr2, false))\n+\t add_temp_assign_before_call (c, gfc_current_ns, expr2);\n+\t}\n+ }\n+}\n+\n /* Resolve a subroutine call. Although it was tempting to use the same code\n for functions, subroutines and functions are stored differently and this\n makes things awkward. */\n@@ -4289,6 +4338,11 @@ resolve_call (gfc_code *c)\n if (!resolve_elemental_actual (NULL, c))\n return false;\n \n+ /* Deal with complicated dependencies that the scalarizer cannot handle. */\n+ if (c->resolved_sym && c->resolved_sym->attr.elemental && !no_formal_args\n+ && c->ext.actual && c->ext.actual->next)\n+ resolve_elemental_dependencies (c);\n+\n if (!c->expr1)\n update_current_proc_array_outer_dependency (csym);\n else\n@@ -13308,10 +13362,12 @@ build_assignment (gfc_exec_op op, gfc_expr *expr1, gfc_expr *expr2,\n \n \n /* Makes a temporary variable expression based on the characteristics of\n- a given variable expression. */\n+ a given variable expression. If allocatable is set, the temporary is\n+ unconditionally allocatable*/\n \n static gfc_expr*\n-get_temp_from_expr (gfc_expr *e, gfc_namespace *ns)\n+get_temp_from_expr (gfc_expr *e, gfc_namespace *ns,\n+\t\t bool allocatable = false)\n {\n static int serial = 0;\n char name[GFC_MAX_SYMBOL_LEN];\n@@ -13365,7 +13421,7 @@ get_temp_from_expr (gfc_expr *e, gfc_namespace *ns)\n tmp->n.sym->attr.intent = INTENT_UNKNOWN;\n \n \n- if (as)\n+ if (as && !allocatable)\n {\n tmp->n.sym->as = gfc_copy_array_spec (as);\n if (!ref)\n@@ -13375,7 +13431,7 @@ get_temp_from_expr (gfc_expr *e, gfc_namespace *ns)\n }\n else if ((e->rank || e->corank)\n \t && (e->expr_type == EXPR_ARRAY || e->expr_type == EXPR_FUNCTION\n-\t || e->expr_type == EXPR_OP))\n+\t || e->expr_type == EXPR_OP || allocatable))\n {\n tmp->n.sym->as = gfc_get_array_spec ();\n tmp->n.sym->as->type = AS_DEFERRED;\n@@ -13394,7 +13450,7 @@ get_temp_from_expr (gfc_expr *e, gfc_namespace *ns)\n \n /* Should the lhs be a section, use its array ref for the\n temporary expression. */\n- if (aref && aref->type != AR_FULL)\n+ if (aref && aref->type != AR_FULL && !allocatable)\n {\n gfc_free_ref_list (e->ref);\n e->ref = gfc_copy_ref (ref);\n@@ -13403,6 +13459,45 @@ get_temp_from_expr (gfc_expr *e, gfc_namespace *ns)\n }\n \n \n+/* Helper function to take an argument in a subroutine call with a dependency\n+ on another argument, copy it to an allocatable temporary and use the\n+ temporary in the call expression. The new code is embedded in a block to\n+ ensure local, automatic deallocation. */\n+\n+static void\n+add_temp_assign_before_call (gfc_code *code, gfc_namespace *ns,\n+\t\t\t gfc_expr **rhsptr)\n+{\n+ gfc_namespace *block_ns;\n+ gfc_expr *tmp_var;\n+\n+ /* Wrap the new code in a block so that the temporary is deallocated. */\n+ block_ns = gfc_build_block_ns (ns);\n+\n+ /* As it stands, the block_ns does not not stand up to resolution because the\n+ the assignment would be converted to a call and, in any case, the modified\n+ call fails in gfc_check_conformance. */\n+ block_ns->resolved = 1;\n+\n+ /* Assign the original expression to the temporary. */\n+ tmp_var = get_temp_from_expr (*rhsptr, block_ns, true);\n+ block_ns->code = build_assignment (EXEC_ASSIGN, tmp_var, *rhsptr,\n+\t\t\t\t NULL, NULL, (*rhsptr)->where);\n+\n+ /* Transfer the call to the block and terminate block code. */\n+ *rhsptr = gfc_copy_expr (tmp_var);\n+ block_ns->code->next = gfc_get_code (EXEC_NOP);\n+ *(block_ns->code->next) = *code;\n+ block_ns->code->next->next = NULL;\n+\n+ /* Convert the original code to execute the block. */\n+ code->op = EXEC_BLOCK;\n+ code->ext.block.ns = block_ns;\n+ code->ext.block.assoc = NULL;\n+ code->expr1 = code->expr2 = NULL;\n+}\n+\n+\n /* Add one line of code to the code chain, making sure that 'head' and\n 'tail' are appropriately updated. */\n \ndiff --git a/gcc/testsuite/gfortran.dg/defined_assignment_13.f90 b/gcc/testsuite/gfortran.dg/defined_assignment_13.f90\nindex 5a8a904fa25..ca0feaec7db 100644\n--- a/gcc/testsuite/gfortran.dg/defined_assignment_13.f90\n+++ b/gcc/testsuite/gfortran.dg/defined_assignment_13.f90\n@@ -119,6 +119,12 @@ contains\n x%i = y%i + 42\n end subroutine sub2\n \n+ impure elemental function f1 (x)\n+ type(t1), intent(in) :: x\n+ type(t1) :: f1\n+ f1%i = x%i + 99\n+ end function f1\n+\n subroutine extra_tests ()\n integer :: j\n type(t1) :: p1(4), q1(4) = [(t1(j),j=1,4)]\n@@ -127,6 +133,7 @@ contains\n integer :: iperm(2) = [1,2]\n integer :: expect1(4) = [25,24,0,0]\n integer :: expect2(4) = [44,43,0,0]\n+ integer :: expect3(4) = [123,124,3,4]\n \n !-----------------------------------\n ! (1) l.h.s. not depending on r.h.s.\n@@ -261,21 +268,30 @@ contains\n ! l.h.s. vector indices, r.h.s. array section\n ! (this part currently disabled because the temporary for the l.h.s.\n ! is not yet implemented properly)\n-! p1%i = q1%i\n-! p1([2,1]) = p1(1:2)\n-! call check (p1%i, expect1, 71)\n-!\n-! p2%i = q2%i\n-! p2([2,1]) = p2(1:2)\n-! call check (p2%i, expect2, 73)\n+ p1%i = q1%i\n+ p1([2,1]) = p1(1:2)\n+ call check (p1%i, expect1, 71)\n \n-! p1%i = q1%i\n-! call sub1 (p1([2,1]), (p1(1:2)))\n-! call check (p1%i, expect1, 72)\n-!\n-! p2%i = q2%i\n-! call sub2 (p2([2,1]), (p2(1:2)))\n-! call check (p2%i, expect2, 74)\n+ p2%i = q2%i\n+ p2([2,1]) = p2(1:2)\n+ call check (p2%i, expect2, 72)\n+\n+ p1%i = q1%i\n+ call sub1 (p1([2,1]), (p1(1:2)))\n+ call check (p1%i, expect1, 73)\n+\n+ p2%i = q2%i\n+ call sub2 (p2([2,1]), (p2(1:2)))\n+ call check (p2%i, expect2, 74)\n+\n+ ! l.h.s. vector indices, r.h.s. array section as a function arg.\n+ p1%i = q1%i\n+ p1([2,1]) = f1 (p1([2,1]))\n+ call check (p1%i, expect3, 75)\n+\n+ p1%i = q1%i\n+ call sub1(p1([2,1]), f1 (p1([2,1])))\n+ call check (p1%i, expect3, 76)\n \n end subroutine extra_tests\n \n-- \n2.53.0\n\n", "prefixes": [ "fortran" ] }