Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2217383/?format=api
{ "id": 2217383, "url": "http://patchwork.ozlabs.org/api/patches/2217383/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260328113532.12233-1-gonzalo.silvalde@gmail.com/", "project": { "id": 17, "url": "http://patchwork.ozlabs.org/api/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": "<20260328113532.12233-1-gonzalo.silvalde@gmail.com>", "list_archive_url": null, "date": "2026-03-28T11:35:32", "name": "fortran: Fix host association in module procedure interface bodies [PR79330]", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "f4eaf3bda4764f38c0c1902fc777d26b02555497", "submitter": { "id": 92648, "url": "http://patchwork.ozlabs.org/api/people/92648/?format=api", "name": "Gonzalo Silvalde Blanco", "email": "gonzalo.silvalde@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20260328113532.12233-1-gonzalo.silvalde@gmail.com/mbox/", "series": [ { "id": 497862, "url": "http://patchwork.ozlabs.org/api/series/497862/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=497862", "date": "2026-03-28T11:35:32", "name": "fortran: Fix host association in module procedure interface bodies [PR79330]", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/497862/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2217383/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2217383/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=rj+8Bw7e;\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=rj+8Bw7e", "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=none smtp.remote-ip=209.85.128.67" ], "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 4fjb8N043Nz1xtJ\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 28 Mar 2026 22:36:46 +1100 (AEDT)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 9C54D4BA9011\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 28 Mar 2026 11:36:39 +0000 (GMT)", "from mail-wm1-f67.google.com (mail-wm1-f67.google.com\n [209.85.128.67])\n by sourceware.org (Postfix) with ESMTPS id C41454BA23D0\n for <gcc-patches@gcc.gnu.org>; Sat, 28 Mar 2026 11:36:01 +0000 (GMT)", "by mail-wm1-f67.google.com with SMTP id\n 5b1f17b1804b1-487012ce896so17880635e9.0\n for <gcc-patches@gcc.gnu.org>; Sat, 28 Mar 2026 04:36:01 -0700 (PDT)", "from gonzalo.cesga.es ([178.60.12.162])\n by smtp.gmail.com with ESMTPSA id\n 5b1f17b1804b1-48722c6b4d0sm148344715e9.3.2026.03.28.04.35.59\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Sat, 28 Mar 2026 04:35:59 -0700 (PDT)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org 9C54D4BA9011", "OpenDKIM Filter v2.11.0 sourceware.org C41454BA23D0" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org C41454BA23D0", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org C41454BA23D0", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1774697762; cv=none;\n b=du9DY257JMEzqGXoHyp4hvzbcOZzPrXGI64C/cUcOV+yfSfEBvbzIjHs0u3Zo204A5nO9O/4dqIEQY0cwhh30/LLhUNYzUtaGCunAnT3HTCIRBSCbPuWV23TjjxnxGRM36sgjqqAyuwrORdFGHtyJsIj2F0R7pmTxBXRxCV2hDM=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1774697762; c=relaxed/simple;\n bh=55rBBMLpgbJFi1oJq3fTIsWToBZ9kC95Eb2un6iubOI=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=KvCTS3ABy1aMDGoAykpIYogPolEQKIeINDaBqFyEPF3YLM1vpYN9XuFWzd5qZLsH2BCOcE3c/ws8PJVvNMnVWeTpHIrYdqiT7Vlf3wN8zutN7GhhXn0EZQo3Imx0t81VAL14kfSm/YlQB4KsztQ3y0jY/TPM2VZ5wZZBARrOT50=", "ARC-Authentication-Results": "i=1; server2.sourceware.org", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1774697761; x=1775302561; darn=gcc.gnu.org;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:from:to:cc:subject:date:message-id:reply-to;\n bh=/IYEaNE8RInc7KJGISTEuI398zypZvoN3s1vtxYSsbM=;\n b=rj+8Bw7eiDGXsrsqn/KynsRwkSFmEFq8jPCswQeeQ9O3EkqtQQsju7lqpbtJKOiFMH\n WIXlO6s78NFoCbw/EenwzHyXHqefLQkAq+gJtSomClIvZwOyXJ5WeLR46CozICjdPdHA\n MZdu6raG4tgB2pMlwU9n4/mUr3+i5kZ9rOFM0zprzdWiVzREx2dhm6mRsWpOoG8eWXYT\n gw0SYjOBWUk3Kzq2g4BZ0GeT3UwBI3aM4obqo+4sVsNMvtwWY69jk3mIu1181kEJwn8X\n 9dtXNX/j8CpvnuBVaUvIFyvXg+1AoLkPNkewlYLzk24M4DPLW95fo0m9vrsvX4xBJy00\n lxKA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1774697761; x=1775302561;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=/IYEaNE8RInc7KJGISTEuI398zypZvoN3s1vtxYSsbM=;\n b=XPD3Q0Z/wp1lwYTF3wTjyLNmZIz1zQILEaMc5LUxOG+iqUGLpbSQpbYfClhgybbU7d\n syF6oktcPG00mE69J2MxDaVgf8lqAC8zCIPhIzOeBeWzvzcu+ucYeEZSPcfd4LwqeWru\n jLWqfyodBv3O12Twpc8jeLCNcFMC+9Kngkx8bRfZ4ND/P3sTi3KNaCpHVu4gRsmZE+42\n jfwIZmizAmi9lwntFlWXXI92USfcLSJ/i2PymNXIGj/kbW/zudVt6ewNlCBINUmnJQ36\n LNbrd9FegSFF+ZcdjeMZvLe/fjSueP4c98wqteUgxijnRt5eQKlRgk1GyBMv1MP/02d8\n iuTg==", "X-Gm-Message-State": "AOJu0YxfB4gp6Rx47yllAe2AV4scB4gQdI2FwNXU1QG5StfMCA7CnMX9\n k4D9FRXq5a5XuXrW7HSMj060gQ7I8HDO5/6hvgCoVu3bd3rKyIho/pWE97FO3w+g", "X-Gm-Gg": "ATEYQzxGsI7eBw4pjuv39k6H/Xa9tPqdclt0XkHonO8+oSGvo/nRPur2o6Y98K0baj7\n BPesSZDEYNym8OXDls9deHphQOkRxuAgOi8GkIwI7oIB21yO71y+0E7Vaq9q+Xjob4xfMm3zXFk\n 1svOHUX6FDF3BbdF82U9WWW1EzO517FTSRWbEyvosPtFGxmLP1kr8STq2+ofzokhB8gDQxNLCqy\n q5jvJR7ml7jarrwfUwgHZWKPWyad7ol8h4ZAUcAMRlKdkhLqf8plpqybAz7JWYCOnisfWXt2R+B\n erug/xZU+F0WMetu0UDLYO4Nza7kmKxPKMHGvN/Zt3hY3YJcs/geFPxaNaJ0ymV6wNxW8hhs9t6\n 8V68iaT+1aWaaC4qkqhpUO+rOkAjrabMX6ZT3dBiIoDe266fIoEXKdKWbPK2UZzg5FqVy0RmaSh\n od9vqoNRbPRw9RWdvGGs2WKfv0ameyQc//VYj6", "X-Received": "by 2002:a05:600c:a108:b0:485:3a27:a961 with SMTP id\n 5b1f17b1804b1-48727c82082mr82671375e9.0.1774697760418;\n Sat, 28 Mar 2026 04:36:00 -0700 (PDT)", "From": "Gonzalosilvalde <gonzalo.silvalde@gmail.com>", "To": "gcc-patches@gcc.gnu.org", "Cc": "fortran@gcc.gnu.org,\n\tGonzalosilvalde <gonzalo.silvalde@gmail.com>", "Subject": "[PATCH] fortran: Fix host association in module procedure interface\n bodies [PR79330]", "Date": "Sat, 28 Mar 2026 12:35:32 +0100", "Message-ID": "<20260328113532.12233-1-gonzalo.silvalde@gmail.com>", "X-Mailer": "git-send-email 2.47.3", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "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": "Named constants from the host scope were not accessible in module\nprocedure interface bodies, causing bind(C, name=...) expressions\nreferencing such constants to fail. The compiler treated the constant\nas an implicitly typed REAL(4) variable instead of resolving it from\nthe enclosing module scope.\n\nThe fix sets has_import_set on the current namespace when a module\nprocedure is detected inside an interface block, before bind(C) is\nparsed, so that symbol lookup can reach the host scope.\n\ngcc/fortran/ChangeLog:\n\n\tPR fortran/79330\n\t* decl.cc (gfc_match_subroutine): Set has_import_set when\n\tmatching a module procedure inside an interface block.\n\t(gfc_match_function_decl): Likewise.\n\ngcc/testsuite/ChangeLog:\n\n\tPR fortran/79330\n\t* gfortran.dg/bind_c_module_proc.f90: New test.\n---\n gcc/fortran/decl.cc | 12 ++++++++++--\n .../gfortran.dg/bind_c_module_proc.f90 | 18 ++++++++++++++++++\n 2 files changed, 28 insertions(+), 2 deletions(-)\n create mode 100644 gcc/testsuite/gfortran.dg/bind_c_module_proc.f90", "diff": "diff --git a/gcc/fortran/decl.cc b/gcc/fortran/decl.cc\nindex 454b65f2c47..faf404d994a 100644\n--- a/gcc/fortran/decl.cc\n+++ b/gcc/fortran/decl.cc\n@@ -8191,7 +8191,11 @@ gfc_match_function_decl (void)\n sym = sym->result;\n \n if (current_attr.module_procedure)\n- sym->attr.module_procedure = 1;\n+ {\n+ sym->attr.module_procedure = 1;\n+ if (gfc_current_state () == COMP_INTERFACE)\n+ gfc_current_ns->has_import_set = 1;\n+ }\n \n gfc_new_block = sym;\n \n@@ -8687,7 +8691,11 @@ gfc_match_subroutine (void)\n \t\t\t\t\t &gfc_current_locus);\n \n if (current_attr.module_procedure)\n- sym->attr.module_procedure = 1;\n+ {\n+ sym->attr.module_procedure = 1;\n+ if (gfc_current_state () == COMP_INTERFACE)\n+ gfc_current_ns->has_import_set = 1;\n+ }\n \n if (add_hidden_procptr_result (sym))\n sym = sym->result;\ndiff --git a/gcc/testsuite/gfortran.dg/bind_c_module_proc.f90 b/gcc/testsuite/gfortran.dg/bind_c_module_proc.f90\nnew file mode 100644\nindex 00000000000..2df933f3c14\n--- /dev/null\n+++ b/gcc/testsuite/gfortran.dg/bind_c_module_proc.f90\n@@ -0,0 +1,18 @@\n+! { dg-do compile }\n+! PR fortran/79330\n+! Verify that named constants from the host scope are accessible\n+! in module procedure interface bodies for bind(C, name=...).\n+\n+module m\n+ implicit none\n+ character(len=*), parameter :: PREFIX = \"_gfortran_\"\n+ interface\n+ module subroutine sub() bind(C, name=PREFIX//\"caf_sub\")\n+ implicit none\n+ end subroutine\n+ module function func() result(r) bind(C, name=PREFIX//\"caf_func\")\n+ implicit none\n+ integer :: r\n+ end function\n+ end interface\n+end module\n", "prefixes": [] }