{"id":2223607,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2223607/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/1953128.tdWV9SEqCh@fomalhaut/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/1.1/projects/17/?format=json","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},"msgid":"<1953128.tdWV9SEqCh@fomalhaut>","date":"2026-04-15T17:38:49","name":"[Ada] Fix bogus warning for array variable on the LHS of aggregate assignment","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"79b797d2ad778f80f55b56ed966596e94d2a543d","submitter":{"id":78832,"url":"http://patchwork.ozlabs.org/api/1.1/people/78832/?format=json","name":"Eric Botcazou","email":"botcazou@adacore.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/1953128.tdWV9SEqCh@fomalhaut/mbox/","series":[{"id":500025,"url":"http://patchwork.ozlabs.org/api/1.1/series/500025/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=500025","date":"2026-04-15T17:38:49","name":"[Ada] Fix bogus warning for array variable on the LHS of aggregate assignment","version":1,"mbox":"http://patchwork.ozlabs.org/series/500025/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2223607/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2223607/checks/","tags":{},"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=H+1wlXKe;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=temperror (SPF Temporary Error: DNS Timeout) 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 secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256\n header.s=google header.b=H+1wlXKe","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.46"],"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 4fwpQM3ttyz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 16 Apr 2026 03:42:47 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 5A2394BA2E3C\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 15 Apr 2026 17:42:39 +0000 (GMT)","from mail-wm1-f46.google.com (mail-wm1-f46.google.com\n [209.85.128.46])\n by sourceware.org (Postfix) with ESMTPS id 9353D4BA2E17\n for <gcc-patches@gcc.gnu.org>; Wed, 15 Apr 2026 17:42:11 +0000 (GMT)","by mail-wm1-f46.google.com with SMTP id\n 5b1f17b1804b1-488ba840146so70092805e9.1\n for <gcc-patches@gcc.gnu.org>; Wed, 15 Apr 2026 10:42:11 -0700 (PDT)","from fomalhaut.localnet ([2a01:e0a:107c:2f10:e654:e8ff:fe8f:2ce6])\n by smtp.gmail.com with ESMTPSA id\n 5b1f17b1804b1-488ee03898bsm142235395e9.11.2026.04.15.10.42.09\n for <gcc-patches@gcc.gnu.org>\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 15 Apr 2026 10:42:09 -0700 (PDT)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 5A2394BA2E3C","OpenDKIM Filter v2.11.0 sourceware.org 9353D4BA2E17"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 9353D4BA2E17","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 9353D4BA2E17","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776274931; cv=none;\n b=d39U6L4JeRT/7KD9MhuTUnwdMQOSU/AR2lFIwrB8UiHpyAisWEtxbQvTxk5S44Tvb9d2THm95N9cMOyVF7N7npL/KL8G9qxYuvtcYc77a4RzT7ucTdm5A/3h5Z4IqNQ50G7RCU4SRD2SsWqDrm0352G+tgCrpMuGfjJ/3iLiuK8=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776274931; c=relaxed/simple;\n bh=dPDkUgFC5kZUnmGES4xJz3H/JHRA2HKX1KD6wBdWIO4=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=RupuBQ3v6zDTM0a49vEg7gsfYQ3LLkJrhT+T72yCN1rdwV6y8yb4jnVs3NTqK/Z5vJtrlCcrI0/nxgf9ANwuk3Estm4E2pdAqIUCPtAxvjoWwNg6v7dOn0aO6PVRlzSjZS8h9HcbgvqfyrSy9M3wsUmxxpKWUgd+HBDr0fjwwjY=","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=1776274930; x=1776879730; 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=mbmDjMj8peabVFVxPzQDinY0DBY9Y810nNZN7IOrV7M=;\n b=H+1wlXKe54okkZCrYSKgqNy64rRnjgN9UYVRAbmIzaa2Ct/wzSazCcV7DqO8MYQ1Kt\n EXqlxK2V3Wy05I4YS2fV+5EYJH170XJ4GtN6fvXcnIVoMj97Uy25lCpG/Rvu62AMD9VU\n EE73A3wHeMB/ML8W4tOq8LKtpOTqjQs332tCMbNl4NBw/P9FNGJUOchX34sHB5kzE+Sv\n nheFlJ7qdFHp5mThckyYCUHp+hHJ2fc/2kBLKQJGpjOmkStaOwv5yamsNj9+TfpPKvKw\n zabaldm1kQay7osaIk/nRugWKmgmYv1Gtq6ory9ZVCoCpapwtXAjKv7NWAcQ9L6L8AT6\n ep0w==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776274930; x=1776879730;\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=mbmDjMj8peabVFVxPzQDinY0DBY9Y810nNZN7IOrV7M=;\n b=FjncBYUz/z+qemt1rWvC6fd2/th8jS3Vt67TjJjf/cOxwGo08Z102QwFkLlnday9z1\n HzcQJgTyetUduYTOLO3Ih5WaEVHSYM4gIRhN7deOG6KW8cnK4AWxXE1/WwjvbqJzxS5J\n dE68VdSgimlkVLIIoHJjUR+CaK2OPbxmgD2ErE2OdYQIzV51H8550gV9Rjl6709sbiEV\n v72E4B1Wj3LtzNU1XaP7fC4zcddWSXqVjxPJb2wuYitPFmry6vxC9BKsx8zX4lMfQXGm\n A4BSo6biRfTsARDUppP9RB//Xeg8FUFNdMNgL5sVmYnMmW9Z5jwHl0YN9uhsKKZlc4I7\n 1+qg==","X-Gm-Message-State":"AOJu0YyDdlDTs0n6VKNVW2+NstKKH8gM90kPuPhgJIq0yhQ7Vq6/qxPs\n yB5hj7JCtxBdF2jhYT79TsKtBAOWzqZtbqp4ySRm3f/jp7spTeoavBw5Tsg+Tnihmt2rGL1kgwg\n Fz8w=","X-Gm-Gg":"AeBDiet9/Sia4Vm1WniNBNnCm59S8U1TZi33G8RVCGheu82EAyi47e0c/hEmTYDzHqC\n /5I8bc7zXfkFgFnw5aaYGDAED43nRG05HFpl7onmGt93hYI0kGLKCtqLsbONr4v6e8f9adD6AMM\n RmOLUpQGZTBkJxnAdmEXiqUNjYR2xCXZdbMMdq8P8a6u2NcBbgGX+GX95H/8HZA1DxKONNTytRk\n uZNnfk7UGbzZ2tZMe+u+NGqoYt/kLXXckJQuUSsr+UQQNifLZjh8S1xv3S3HsOYI+iWNi/uo3Ue\n PiwiaA+pj1hIXRs0uMoCHWC3rwlFvMKFzEXDJyE0S4RM0Fs1XLfKVn8YoGgtclGkInNTQ3kltgZ\n M+d5r65po7ndD7Imwa1lKD7ggV3AEnvCfCY9eFg5IKVlhOzFI7oEY1diqVYEL0+nvle1ORznAmv\n j7o7bm95VN6hr+hiMH+62y5X+mDEUfQifonvYrbuGTwNob7z4=","X-Received":"by 2002:a05:600c:3b0e:b0:487:20ee:bef6 with SMTP id\n 5b1f17b1804b1-488d67e65fdmr317251745e9.11.1776274930370;\n Wed, 15 Apr 2026 10:42:10 -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 bogus warning for array variable on the LHS of aggregate\n assignment","Date":"Wed, 15 Apr 2026 19:38:49 +0200","Message-ID":"<1953128.tdWV9SEqCh@fomalhaut>","MIME-Version":"1.0","Content-Type":"multipart/mixed; boundary=\"nextPart2260340.irdbgypaU6\"","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":"That's another ancient issue with -gnatwu, but the fix is again trivial.\n\nTested on x86-64/Linux, applied on the mainline.\n\n\n2026-04-15  Eric Botcazou  <ebotcazou@adacore.com>\n\n\tPR ada/105212\n\t* exp_aggr.adb (Build_Array_Aggr_Code): If the aggregate comes from\n\tsource, call Set_Referenced_Modified on the target.\n\n\n2026-04-15  Eric Botcazou  <ebotcazou@adacore.com>\n\n\t* gnat.dg/warn36.adb: New test.","diff":"diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb\nindex 4b14043d276..82afcaaa0e8 100644\n--- a/gcc/ada/exp_aggr.adb\n+++ b/gcc/ada/exp_aggr.adb\n@@ -2026,6 +2026,16 @@ package body Exp_Aggr is\n          end;\n       end if;\n \n+      --  Set Referenced_As_LHS if appropriate. We are neither interested\n+      --  in compiler-generated aggregates, nor in references outside the\n+      --  extended main source unit.\n+\n+      if Comes_From_Source (N)\n+        and then In_Extended_Main_Source_Unit (Into)\n+      then\n+         Set_Referenced_Modified (Into, Out_Param => False);\n+      end if;\n+\n       --  First before we start, a special case. If we have a bit packed\n       --  array represented as a modular type, then clear the value to\n       --  zero first, to ensure that unused bits are properly cleared.\n","prefixes":["Ada"]}