{"id":2221753,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2221753/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/20260410090908.274157-1-tkaminsk@redhat.com/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/1.2/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,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260410090908.274157-1-tkaminsk@redhat.com>","list_archive_url":null,"date":"2026-04-10T09:07:38","name":"libstdc++: Test for using non-ascii unicode fill with non-unicode encoding.","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"9284c95f512f0ba4173c296b72478a57476f809d","submitter":{"id":90409,"url":"http://patchwork.ozlabs.org/api/1.2/people/90409/?format=json","name":"Tomasz Kaminski","email":"tkaminsk@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/20260410090908.274157-1-tkaminsk@redhat.com/mbox/","series":[{"id":499430,"url":"http://patchwork.ozlabs.org/api/1.2/series/499430/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=499430","date":"2026-04-10T09:07:38","name":"libstdc++: Test for using non-ascii unicode fill with non-unicode encoding.","version":1,"mbox":"http://patchwork.ozlabs.org/series/499430/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2221753/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2221753/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 (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=XtsEp0uG;\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 (1024-bit key,\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=XtsEp0uG","sourceware.org; dmarc=pass (p=quarantine dis=none)\n header.from=redhat.com","sourceware.org; spf=pass smtp.mailfrom=redhat.com","server2.sourceware.org;\n arc=none smtp.remote-ip=170.10.133.124"],"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 4fsWGQ49stz1yGb\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 10 Apr 2026 19:09:48 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 790AD4BA23C0\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 10 Apr 2026 09:09:46 +0000 (GMT)","from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n by sourceware.org (Postfix) with ESMTP id 139B24BA2E15\n for <gcc-patches@gcc.gnu.org>; Fri, 10 Apr 2026 09:09:14 +0000 (GMT)","from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-424-QhM43i0LNUK1gcR5JNmykw-1; Fri,\n 10 Apr 2026 05:09:11 -0400","from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id DA7271956095; Fri, 10 Apr 2026 09:09:10 +0000 (UTC)","from localhost (unknown [10.44.32.176])\n by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 509AF1800451; Fri, 10 Apr 2026 09:09:09 +0000 (UTC)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 790AD4BA23C0","OpenDKIM Filter v2.11.0 sourceware.org 139B24BA2E15"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 139B24BA2E15","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 139B24BA2E15","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775812154; cv=none;\n b=aSBwFikOEtITcdY/k9Ofi89KS28u/U1/RCeNqVOR+mjtaWslQEgB2dkaPASofzhtJ3bRVlYkxG9uH1uFf6bP4rJ4fWm8EBukQJkqP5cCLLl2zZEAQjYtdJqu5brisx21tcrp+k8O9u5fGlN94P6b9JrH5/vaOMdkdfSGCRTW4mQ=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1775812154; c=relaxed/simple;\n bh=5tY/awCkRMNRLppGuRKErqLciekaLZy02q4m6EtltwI=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=fzM0CZtETF1O7UGdX6qVDAGtlEkmWYUkLUixeHKmKkad16uoCw2HODBLtVznguJq/wtj7Xtzchh9fxxDI+1TgkjA/KGb/ajsv3IAt3waxgm9J5g+51mhl8CQR+ZLrFvqLHE20IK40ut6kRIPI5O7hMyNipOhvnoIGuE6HWL9sSI=","ARC-Authentication-Results":"i=1; server2.sourceware.org","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1775812153;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding;\n bh=61ZoeprfqFkYcBwDtIqFaf+7NwAndl6rC7cae+LN8CE=;\n b=XtsEp0uG6a9ft9eGoJ8K/9qxm4WVr3IpWcHsNFSzaIGjDRdkkfFw5Jfa86SF/wv+haBSK/\n CdhjVkLDznVxRYn1wq7nWqSUcDZ70Gi7wkFki36tMQCqzIjhpCHaLDDt/72OfjrfibtXUt\n wyZhQE17lyv0xu6z4vRU33ysjgeg0EE=","X-MC-Unique":"QhM43i0LNUK1gcR5JNmykw-1","X-Mimecast-MFC-AGG-ID":"QhM43i0LNUK1gcR5JNmykw_1775812151","From":"=?utf-8?q?Tomasz_Kami=C5=84ski?= <tkaminsk@redhat.com>","To":"libstdc++@gcc.gnu.org,\n\tgcc-patches@gcc.gnu.org","Subject":"[PATCH] libstdc++: Test for using non-ascii unicode fill with\n non-unicode encoding.","Date":"Fri, 10 Apr 2026 11:07:38 +0200","Message-ID":"<20260410090908.274157-1-tkaminsk@redhat.com>","MIME-Version":"1.0","X-Scanned-By":"MIMEDefang 3.4.1 on 10.30.177.93","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"Sx63a0K5sJROO3xQ4eBpdVjWXxXRNPhQ686FnYnoz3E_1775812151","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain; charset=UTF-8","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":"This checks if format string using as fill character an Unicode code-point,\nthat is encoded as multiple code units, is rejected when literal encoding\nis not Unicode.\n\nlibstdc++-v3/ChangeLog:\n\n\t* testsuite/std/format/fill.cc: New test.\n\t* testsuite/std/format/fill_nonunicode.cc: New test.\n\nSigned-off-by: Tomasz Kamiński <tkaminsk@redhat.com>\n---\nThis test fails, if we use __do_vformat_to defintion with formatters\ncompiled with unicode literal encoding, from TU that uses non-literal\nencoding (fill-nonunicode).\n\nTested on x86_64-linux. OK for trunk?\n\n libstdc++-v3/testsuite/std/format/fill.cc     | 56 +++++++++++++++++++\n .../testsuite/std/format/fill_nonunicode.cc   |  5 ++\n 2 files changed, 61 insertions(+)\n create mode 100644 libstdc++-v3/testsuite/std/format/fill.cc\n create mode 100644 libstdc++-v3/testsuite/std/format/fill_nonunicode.cc","diff":"diff --git a/libstdc++-v3/testsuite/std/format/fill.cc b/libstdc++-v3/testsuite/std/format/fill.cc\nnew file mode 100644\nindex 00000000000..d281ec1080a\n--- /dev/null\n+++ b/libstdc++-v3/testsuite/std/format/fill.cc\n@@ -0,0 +1,56 @@\n+// { dg-options \"-fexec-charset=UTF-8 -DUNICODE_ENC\" }\n+// { dg-do run { target c++20 } }\n+\n+#include <format>\n+#include <testsuite_hooks.h>\n+\n+template<typename... Args>\n+bool\n+is_format_string_for(const char* str, Args&&... args)\n+{\n+  try {\n+    (void) std::vformat(str, std::make_format_args(args...));\n+    return true;\n+  } catch (const std::format_error&) {\n+    return false;\n+  }\n+}\n+\n+template<typename T>\n+void\n+test_fill(T t)\n+{\n+  constexpr bool accept_utf8_nonascii\n+#ifdef UNICODE_ENC\n+   = true;\n+#else\n+   = false;\n+#endif\n+\n+   VERIFY(is_format_string_for(\"{: <}\", t));\n+   VERIFY(is_format_string_for(\"{:Å<}\", t));\n+   // U+0119 Latin Small Letter E with Ogonek\n+   VERIFY(is_format_string_for(\"{:\\xC4\\x99<}\", t) == accept_utf8_nonascii);\n+   // U+2705 White Heavy Check Mark\n+   VERIFY(is_format_string_for(\"{:\\xE2\\x9C\\x85<}\", t) == accept_utf8_nonascii);\n+   // U+1F602 Face with Tears of Joy\n+   VERIFY(is_format_string_for(\"{:\\xF0\\x9F\\x98\\x82<}\", t) == accept_utf8_nonascii);\n+}\n+\n+struct MyStringView : std::string_view\n+{\n+  using std::string_view::string_view;\n+};\n+\n+template<>\n+struct std::formatter<MyStringView, char>\n+  : std::formatter<std::string_view, char>\n+{};\n+\n+int main()\n+{\n+  test_fill(10);\n+  test_fill(std::string_view(\"test\"));\n+  // Test with type stored by handle\n+  test_fill(MyStringView(\"test\"));\n+}\ndiff --git a/libstdc++-v3/testsuite/std/format/fill_nonunicode.cc b/libstdc++-v3/testsuite/std/format/fill_nonunicode.cc\nnew file mode 100644\nindex 00000000000..1370cf57ccd\n--- /dev/null\n+++ b/libstdc++-v3/testsuite/std/format/fill_nonunicode.cc\n@@ -0,0 +1,5 @@\n+// { dg-options \"-fexec-charset=ISO8859-1\" }\n+// { dg-do run { target c++20 } }\n+// { dg-add-options no_pch }\n+\n+#include \"fill.cc\"\n","prefixes":[]}