Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2217147/?format=api
{ "id": 2217147, "url": "http://patchwork.ozlabs.org/api/patches/2217147/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/3037353.e9J7NaK4W3@fomalhaut/", "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": "<3037353.e9J7NaK4W3@fomalhaut>", "list_archive_url": null, "date": "2026-03-27T17:40:38", "name": "[Ada] Fix overriding indicator wrongly rejected on protected procedure in generic", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "2fe9c92b2e99660609a6ee8369fbe3d9bd980271", "submitter": { "id": 78832, "url": "http://patchwork.ozlabs.org/api/people/78832/?format=api", "name": "Eric Botcazou", "email": "botcazou@adacore.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/3037353.e9J7NaK4W3@fomalhaut/mbox/", "series": [ { "id": 497809, "url": "http://patchwork.ozlabs.org/api/series/497809/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=497809", "date": "2026-03-27T17:40:38", "name": "[Ada] Fix overriding indicator wrongly rejected on protected procedure in generic", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/497809/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2217147/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2217147/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 secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256\n header.s=google header.b=JT+WvPgt;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=38.145.34.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 secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256\n header.s=google header.b=JT+WvPgt", "sourceware.org; dmarc=pass (p=quarantine dis=none)\n header.from=adacore.com", "sourceware.org; spf=pass smtp.mailfrom=adacore.com", "server2.sourceware.org;\n arc=none smtp.remote-ip=209.85.128.47" ], "Received": [ "from vm01.sourceware.org (vm01.sourceware.org [38.145.34.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 4fj7HF2bRdz1y1x\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 28 Mar 2026 04:41:27 +1100 (AEDT)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id DFDFD4BA23D6\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 27 Mar 2026 17:41:24 +0000 (GMT)", "from mail-wm1-f47.google.com (mail-wm1-f47.google.com\n [209.85.128.47])\n by sourceware.org (Postfix) with ESMTPS id 1E3184BA23DC\n for <gcc-patches@gcc.gnu.org>; Fri, 27 Mar 2026 17:40:41 +0000 (GMT)", "by mail-wm1-f47.google.com with SMTP id\n 5b1f17b1804b1-486fb112c09so24245175e9.1\n for <gcc-patches@gcc.gnu.org>; Fri, 27 Mar 2026 10:40:41 -0700 (PDT)", "from fomalhaut.localnet ([2a01:e0a:107c:2f10:e654:e8ff:fe8f:2ce6])\n by smtp.gmail.com with ESMTPSA id\n 5b1f17b1804b1-48722cb0d83sm97934005e9.13.2026.03.27.10.40.38\n for <gcc-patches@gcc.gnu.org>\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Fri, 27 Mar 2026 10:40:39 -0700 (PDT)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org DFDFD4BA23D6", "OpenDKIM Filter v2.11.0 sourceware.org 1E3184BA23DC" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 1E3184BA23DC", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 1E3184BA23DC", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1774633241; cv=none;\n b=RRQxW2XmUmU3RMz+V/uaeyEcoGCGnMs/d488ErFmNNX34qsMsz/efgkw7CUlDXE/ACNoLN+OA5DGIcI5ulRAN9IQwsghUnHwznJD4tRHTe24sYaL7ezKchjToMh3FNHDHAYozsvxVdvxZ1fsypm0ZhmKtYPCPT6ezBnjQEkq9lk=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1774633241; c=relaxed/simple;\n bh=atatEHnb7L/Z5hbvyqiIJRIhrgnCH8mCF/E5Bp4Ju8Q=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=Lz2dBRkcBtiN+4/CTq+NqLIwn86Q+GUzF/qqH73IQJnNnaIkSE7GNvR+Hz4EDLfirihswOtU7UBjHmzqr1Qo6nxaSzjWB1vp7LhcTz9pNqUOSCize3Y+fa6JAgoMGJlXDFT9RBQN+o3yL8hhd1zUFE50v8+It4rYnvsrMBtgcTE=", "ARC-Authentication-Results": "i=1; server2.sourceware.org", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=adacore.com; s=google; t=1774633240; x=1775238040; darn=gcc.gnu.org;\n h=content-transfer-encoding:mime-version:message-id:date:subject:to\n :from:from:to:cc:subject:date:message-id:reply-to;\n bh=1jg3T5/JRo4JFmJacf24FC/WBgDkiushSAzUGVldNxs=;\n b=JT+WvPgtJSSuhYOccOoBDolVo8xOuvDa1ycioA85JHpFcEQlAHFLsmBjx6oKAE2yoW\n F/fgTuDS8NZXshJeyniziTx/+/8KNdLIADHoUD7/itPMMXSfyFzh9Va+VEGxGE38auHq\n WM3qBmn3Hlr/XkD0xDoA2FJh+RDgnrMJwE5/SYSY2H2UPkOOghI5h2j3PvW3QgF7Z21Y\n Ol5/Z+uap1l3WYp+imnFbAEdNSP5QG3KHkgzn8t35+zcV8sluMBdjN39F67VWCzrgm+S\n eqceKQLbCiyL7P4J7bbhUz0yjkkzvj6LoUOs8ER73XZkb23ldcvc2h0bvivZs1cck1PG\n oD8w==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1774633240; x=1775238040;\n h=content-transfer-encoding:mime-version:message-id:date:subject:to\n :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id\n :reply-to;\n bh=1jg3T5/JRo4JFmJacf24FC/WBgDkiushSAzUGVldNxs=;\n b=MhE8WUe6xwqvpFu06BllbsF8tJ7rGZtBl1X1OAlscZgVSpYGZZowYnKMOPzcBQKP7m\n LZKyLjGQqtAaI0pY0f+Wkc2WO1N0bSKavgdGwVbsfYv8umHtkpSe1Sv1TD8Tq3UBnczI\n 8m7PDK+IOOFQOpyiWZKypKwKMjiJnayjVqx0UPowVzxtgmTPnQBu7yk22ACh21o208Qe\n iBS136FTfUxU6LNrcQm9o6qxA7L9P8vfpj10FXcPb5TVgB81hP93wJuF7x68UMvcNoxC\n RuHvWy/Ino9Re8qWpqnOuLp8JmP9jr1fzfTADqmbHApClCK/Iu9KVlTH21FEcifCK4Hr\n 6k7g==", "X-Gm-Message-State": "AOJu0Yz/uD8kNIW/zRBipV871rlJIwDekFCz0iwxYoFMZmCZ+RM1fUND\n ZGcfFxNTWA/Ms502QRZUZfW1sbqVAfemZjObjo9BaPbiDM3FjpqdQ9BM0VzCmkED9KB8hQI8Nra\n q7QY=", "X-Gm-Gg": "ATEYQzy91rey8pBTIiRtI5lODtC/jGn8JtWlfAJ7Twfhlqqg3dYudQC1JNxakUdj+yu\n 1PTyE35m+GQDXmhWL6IBYKoM7bfdGqjLUG4kW5Qb84WVPyIEE64Ibs5XFWWXI+kZBC0+32Q6qMK\n YdhPIxM8DBq/4KxZyXbnnK6LruN+71Ws9uiYxSGqJRkQqhYYyWRdLnacNRU3Spl5sok4NkZnk6N\n dvVEha0O5bBzVpN0f9SYFPYQc6HUYMXCeeSxZzyc4L5YQfVMlPd9bFjyb6a5qUHivHWOP0hBD40\n +AGUx72Lfyz5Y7vdYd7n8dqKZLlz6MqTQH2YOTB0+qd/AHh5LaxEjXT09CgjC2EiYPYiT4utwaJ\n sOG/pBWuuLQ5gguT2JtElI3iCPFK9dv1oP2IE//hpwKRvLvrmAiVoZPnOXZ/440MEpciYxZSjFj\n FZ38Ir//59/RaLIB71/wcDZc82/fR3rt0tq+/98Kfhz2Y3P7A=", "X-Received": "by 2002:a05:600c:3e88:b0:487:1108:48b8 with SMTP id\n 5b1f17b1804b1-48727ee9897mr53260075e9.2.1774633239983;\n Fri, 27 Mar 2026 10:40:39 -0700 (PDT)", "From": "Eric Botcazou <botcazou@adacore.com>", "X-Google-Original-From": "Eric Botcazou <ebotcazou@adacore.com>", "To": "gcc-patches@gcc.gnu.org", "Subject": "[Ada] Fix overriding indicator wrongly rejected on protected\n procedure in generic", "Date": "Fri, 27 Mar 2026 18:40:38 +0100", "Message-ID": "<3037353.e9J7NaK4W3@fomalhaut>", "MIME-Version": "1.0", "Content-Type": "multipart/mixed; boundary=\"nextPart3403472.aeNJFYEL58\"", "Content-Transfer-Encoding": "7Bit", "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": "The case itself is fairly pathological (and very likely not human made), but \nit's a clear incentive to get rid of an old kludge in generic instantiation, \nwhereby the full view of a type is forced on nodes in the generic unit even \nthough only the partial declaration is visible to them.\n\nTested on x86-64/Linux, applied on the mainline.\n\n\n2026-03-27 Eric Botcazou <ebotcazou@adacore.com>\n\n\tPR ada/124596\n\t* sem_ch12.ads (Check_Private_View): Move around.\n\t* sem_ch12.adb (Check_Private_View): Retrieve the partial view\n\tby means of a call to Incomplete_Or_Partial_View.\n\t(Save_Global_References.Set_Global_Type): Do not force the full\n\tview of a type when only the partial declaration is visible.\n\t* sem_res.adb (Resolve_Actuals.Insert_Default): Remove obsolete\n\tcode coping with the above kludge.\n\n\n2026-03-27 Eric Botcazou <ebotcazou@adacore.com>\n\n\t* gnat.dg/generic_inst21.adb: New test.", "diff": "diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb\nindex c2697c74f96..2710d0545f4 100644\n--- a/gcc/ada/sem_ch12.adb\n+++ b/gcc/ada/sem_ch12.adb\n@@ -9235,15 +9235,19 @@ package body Sem_Ch12 is\n and then (not In_Open_Scopes (Scope (Typ))\n or else Nkind (Parent (N)) = N_Subtype_Declaration)\n then\n+ -- In the generic unit, only the private declaration was visible,\n+ -- so restore the partial view of Typ when there was an explicit\n+ -- declaration of its full view.\n+\n declare\n- Assoc : constant Node_Id := Get_Associated_Node (N);\n+ Priv_Typ : constant Entity_Id :=\n+ Incomplete_Or_Partial_View (Typ, Partial_Only => True);\n \n begin\n- -- In the generic, only the private declaration was visible\n-\n- Prepend_Elmt (Typ, Exchanged_Views);\n- Exchange_Declarations\n- (if Comparison then Compare_Type (Assoc) else Etype (Assoc));\n+ if Present (Priv_Typ) then\n+ Prepend_Elmt (Typ, Exchanged_Views);\n+ Exchange_Declarations (Priv_Typ);\n+ end if;\n end;\n \n -- Check that the available views of Typ match their respective flag.\n@@ -18607,22 +18611,10 @@ package body Sem_Ch12 is\n elsif No (Full_View (Typ)) and then Typ /= Etype (Typ) then\n null;\n \n- -- Otherwise mark the type for flipping and set the full view on N2\n- -- when available, which is necessary for Check_Private_View to swap\n- -- back the views in case the full declaration of Typ is visible in\n- -- the instantiation context. Note that this will be problematic if\n- -- N2 is re-analyzed later, e.g. if it's a default value in a call.\n+ -- Otherwise mark the node as seeing the private view\n \n else\n Set_Has_Private_View (N);\n-\n- if Present (Full_View (Typ)) then\n- if Comparison then\n- Set_Compare_Type (N2, Full_View (Typ));\n- else\n- Set_Etype (N2, Full_View (Typ));\n- end if;\n- end if;\n end if;\n \n if Is_Floating_Point_Type (Typ)\ndiff --git a/gcc/ada/sem_ch12.ads b/gcc/ada/sem_ch12.ads\nindex 478d968ce95..94f6f9829b1 100644\n--- a/gcc/ada/sem_ch12.ads\n+++ b/gcc/ada/sem_ch12.ads\n@@ -64,6 +64,22 @@ package Sem_Ch12 is\n -- this call, then Parent_Installed is set True, otherwise Parent_Installed\n -- is unchanged by the call.\n \n+ procedure Check_Private_View (N : Node_Id);\n+ -- Check whether the type of a generic entity has a different view between\n+ -- the point of generic analysis and the point of instantiation. If the\n+ -- view has changed, then at the point of instantiation we restore the\n+ -- correct view to perform semantic analysis of the instance, and reset\n+ -- the current view after instantiation. The processing is driven by the\n+ -- current private status of the type of the node, and Has_Private_View,\n+ -- a flag that is set at the point of generic compilation. If view and\n+ -- flag are inconsistent then the type is updated appropriately. A second\n+ -- flag Has_Secondary_Private_View is used to update a second type related\n+ -- to this type if need be.\n+ --\n+ -- This subprogram is used in Check_Generic_Actuals and Copy_Generic_Node,\n+ -- and is exported here for the purpose of front-end inlining (see Exp_Ch6.\n+ -- Expand_Inlined_Call.Process_Formals).\n+\n function Copy_Generic_Node\n (N : Node_Id;\n Parent_Id : Node_Id;\n@@ -228,20 +244,4 @@ package Sem_Ch12 is\n procedure Initialize;\n -- Initializes internal data structures\n \n- procedure Check_Private_View (N : Node_Id);\n- -- Check whether the type of a generic entity has a different view between\n- -- the point of generic analysis and the point of instantiation. If the\n- -- view has changed, then at the point of instantiation we restore the\n- -- correct view to perform semantic analysis of the instance, and reset\n- -- the current view after instantiation. The processing is driven by the\n- -- current private status of the type of the node, and Has_Private_View,\n- -- a flag that is set at the point of generic compilation. If view and\n- -- flag are inconsistent then the type is updated appropriately. A second\n- -- flag Has_Secondary_Private_View is used to update a second type related\n- -- to this type if need be.\n- --\n- -- This subprogram is used in Check_Generic_Actuals and Copy_Generic_Node,\n- -- and is exported here for the purpose of front-end inlining (see Exp_Ch6.\n- -- Expand_Inlined_Call.Process_Formals).\n-\n end Sem_Ch12;\ndiff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb\nindex 7f168499426..53cef024b32 100644\n--- a/gcc/ada/sem_res.adb\n+++ b/gcc/ada/sem_res.adb\n@@ -4038,23 +4038,6 @@ package body Sem_Res is\n and then Has_Discriminants (Etype (Actval))\n then\n Analyze_And_Resolve (Actval, Base_Type (Etype (Actval)));\n-\n- -- Resolve entities with their own type, which may differ from\n- -- the type of a reference in a generic context because of the\n- -- trick used in Save_Global_References.Set_Global_Type to set\n- -- full views forcefully, which did not anticipate the need to\n- -- re-analyze default values in calls.\n-\n- elsif Is_Entity_Name (Actval) then\n- Analyze_And_Resolve (Actval, Etype (Entity (Actval)));\n-\n- -- Ditto for calls whose name is an entity, for the same reason\n-\n- elsif Nkind (Actval) = N_Function_Call\n- and then Is_Entity_Name (Name (Actval))\n- then\n- Analyze_And_Resolve (Actval, Etype (Entity (Name (Actval))));\n-\n else\n Analyze_And_Resolve (Actval, Etype (Actval));\n end if;\n", "prefixes": [ "Ada" ] }