{"id":2223606,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2223606/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/5984042.DvuYhMxLoT@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":"<5984042.DvuYhMxLoT@fomalhaut>","date":"2026-04-15T17:33:10","name":"[Ada] Fix bogus warning for character literal referenced in string literal","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"1b35d20f80d83fe542edac234f2a85e60736a88b","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/5984042.DvuYhMxLoT@fomalhaut/mbox/","series":[{"id":500024,"url":"http://patchwork.ozlabs.org/api/1.1/series/500024/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=500024","date":"2026-04-15T17:33:10","name":"[Ada] Fix bogus warning for character literal referenced in string literal","version":1,"mbox":"http://patchwork.ozlabs.org/series/500024/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2223606/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2223606/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=MiVlSlwb;\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=MiVlSlwb","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.221.41"],"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 4fwpQ05phDz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 16 Apr 2026 03:42:48 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 000684BA2E0E\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 15 Apr 2026 17:42:46 +0000 (GMT)","from mail-wr1-f41.google.com (mail-wr1-f41.google.com\n [209.85.221.41])\n by sourceware.org (Postfix) with ESMTPS id 75D804BA2E39\n for <gcc-patches@gcc.gnu.org>; Wed, 15 Apr 2026 17:42:13 +0000 (GMT)","by mail-wr1-f41.google.com with SMTP id\n ffacd0b85a97d-43cf8d550bdso6525830f8f.0\n for <gcc-patches@gcc.gnu.org>; Wed, 15 Apr 2026 10:42:13 -0700 (PDT)","from fomalhaut.localnet ([2a01:e0a:107c:2f10:e654:e8ff:fe8f:2ce6])\n by smtp.gmail.com with ESMTPSA id\n ffacd0b85a97d-43ead3e0091sm5922112f8f.25.2026.04.15.10.42.11\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:11 -0700 (PDT)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 000684BA2E0E","OpenDKIM Filter v2.11.0 sourceware.org 75D804BA2E39"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 75D804BA2E39","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 75D804BA2E39","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776274933; cv=none;\n b=a2hDw1Y2iZKCk7U0cv/y4tT+TiVUdAVe9AZw+JEO5kwzowMduy5g5VKdRPVgAUoeC7ORowJdHHuEKdg2wFUpDWQdzcrxJnZaAtdlTJhZ7qlXEKi6P0FW70996CeN6hG0IDGLB2ST2WMMcU98Ia4XuieFfRRnGoRAfAZ7UdvMzfo=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776274933; c=relaxed/simple;\n bh=v5Xj0JU00WAs7yAzvi/Pl5wxxKihQvnuByZjQE8UaLo=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=e0XAk93fg/H6czOABV/siydTnQ/DfLzefFYc9FL069+MeSeDVIz38GDYyYqM7sn/L9cZPwp6MZKFDNE7Cv5sCyUFYJn+nZjurcdtn8icB+hf+f63H7vfc3gbGAPMd4iDQvSmwBPeZDiGPpAS10GDnsS+GutnKblNDH1zkOulNZk=","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=1776274932; x=1776879732; 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=vgDXs+6kqkaLDIjCj11Bz1PK5pdaQWeaFq4vlJRtUPU=;\n b=MiVlSlwb42ZFE5IhJYNcx2/k2oVyKx7EUJJdLkkbSj3eFhUUIPl9OKN6pRqNjlRk6J\n uXF0pRAC9O0FR4orhLclw9AfFQmNHjQGv5HTyHwEwlULYO3BD98MciKP0Os1Vs8XgKM8\n BeyRIx0l6iWihj11s63S8t9OCHLgo35EqhY7nsiBLM6aaWHqIpTeqiw+ZhdWvu3oFW3a\n P/A9mWWOH8sX7hfhryOjDDxqTgoQD4Ak+OCcZNmI1hXRGcWgkv/dy8KsaqK9Y425cD7y\n CwWXTrZ93PUOUo7qN6F2xwK2OK91NQgzX/BuPP8k22ittRjpoINhSDBo0N78qkugypxG\n eqFQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776274932; x=1776879732;\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=vgDXs+6kqkaLDIjCj11Bz1PK5pdaQWeaFq4vlJRtUPU=;\n b=IiKndvrRQhqw9YU8ws2ePYvIleHBtRvUjD8k8CPpcSk5EPwHmvt8akg6FsYITUtKXY\n rp1o59YJzJnCLDhgGjArBFFr3889Qv0muJeUfYHdTuHSjcdKMiSymsWZnB7XCj8QO3Sq\n B/2DliwsUQ+Kfavt2Abg/lJOZp9pztur7Z7irpito66cDUk7CfyNsb7TH770ky7bjcr7\n k1bqjKXVldM5y/KjW7SWCbcybju/A18nC5ff/vhF2KTze4dehrlXm2A5IEHF3mnaXP4h\n R1wu+6KwPyDP2uW6dnfp8lDMe65PSZn/17RuVh7hxznHtRoX5A01KFHQcsiAgk/0nqdR\n 4Ztg==","X-Gm-Message-State":"AOJu0YzxYkd0HNmg53pvtnI2j5YX+eWDSow702mA9t6X0bm+ESlONZd0\n n9s2gg5i8sxkCR9mz/WG8Gbyn596rzatQS6QBwtUAyC7bO8tTfvdksKw14pgTi9CBF99CA4J3tC\n 9XcU=","X-Gm-Gg":"AeBDieuSrCKuFZrUsqnAadWJdE32tIYF4X/FVerb9XyDYVfcWejFatF1KJW9LRNhfTs\n DqNnNGmLnocLEBucIIpuElLEnxrMl09MLe1FjnSSYQaOFeIiaFyI033zCv6v9jtjEN4rpsX7/ac\n Amqb3JAzDGDfU73jj5LCGz5gzqqoozggQKx/GOx6l8GoZ6PIypd+xHTH8Mhb3hwsBH9z+cucVUu\n Jf6SB2jQHRvd/RYArpXJkQmpk4+psPmBQzHR2SXDF/1jnvlmDodzDAU4NX/DNT7x36zUE6zXSbH\n xxfQvSrly5UTKqFQWkc4+gUB9O9maqn9M30t5ovTAssL2Y2uVA4R/64pKraRfgqyHcaeUdTuYNp\n kXKELKm4G+gM5vx5B56QPlGaFpHt8/1DnWtPAmc9mNY5P6SHxdPaXPf5kKKhdJlCZUxx77sF2Ca\n ohHsv5CSAqIyKTpDAlf7ojvCYlQrqFe8OYMJ0LeCLr4TAWyNE=","X-Received":"by 2002:a05:6000:230a:b0:43b:6a55:e26a with SMTP id\n ffacd0b85a97d-43d642dd77fmr34183182f8f.51.1776274931873;\n Wed, 15 Apr 2026 10:42:11 -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 character literal referenced in string\n literal","Date":"Wed, 15 Apr 2026 19:33:10 +0200","Message-ID":"<5984042.DvuYhMxLoT@fomalhaut>","MIME-Version":"1.0","Content-Type":"multipart/mixed; boundary=\"nextPart6257808.lOV4Wx5bFT\"","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 an 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/87170\n\t* sem_res.adb (Resolve_String_Literal): Copy Comes_From_Source from\n\tthe string literal to the character literals.\n\n\n2026-04-15  Eric Botcazou  <ebotcazou@adacore.com>\n\n\t* gnat.dg/warn35.adb: New test.","diff":"diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb\nindex 53cef024b32..e5abc01fc8b 100644\n--- a/gcc/ada/sem_res.adb\n+++ b/gcc/ada/sem_res.adb\n@@ -12266,12 +12266,13 @@ package body Sem_Res is\n          end if;\n       end if;\n \n-      --  If we got here we meed to transform the string literal into the\n+      --  If we got here, we need to transform the string literal into the\n       --  equivalent qualified positional array aggregate. This is rather\n       --  heavy artillery for this situation, but it is hard work to avoid.\n \n       declare\n          Lits : constant List_Id := New_List;\n+         Lit  : Node_Id;\n          P    : Source_Ptr := Loc + 1;\n          C    : Char_Code;\n \n@@ -12284,10 +12285,12 @@ package body Sem_Res is\n             C := Get_String_Char (Str, J);\n             Set_Character_Literal_Name (C);\n \n-            Append_To (Lits,\n+            Lit :=\n               Make_Character_Literal (P,\n                 Chars              => Name_Find,\n-                Char_Literal_Value => UI_From_CC (C)));\n+                Char_Literal_Value => UI_From_CC (C));\n+            Preserve_Comes_From_Source (Lit, N);\n+            Append_To (Lits, Lit);\n \n             if In_Character_Range (C) then\n                P := P + 1;\n","prefixes":["Ada"]}