From patchwork Wed Nov 23 08:51:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 24800 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2670106wrr; Wed, 23 Nov 2022 00:52:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf4KOWY6BVy74qEIZ6bvoRhT2yBy1NP0AYOuM0b6CY8M9kvRowQTQv6uueEz+TjIymaO3KST X-Received: by 2002:a17:906:a387:b0:78d:946e:f65d with SMTP id k7-20020a170906a38700b0078d946ef65dmr23000964ejz.365.1669193548884; Wed, 23 Nov 2022 00:52:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669193548; cv=none; d=google.com; s=arc-20160816; b=kAjnPretb8Ixv8rrrXp+uq9R5VPbNZHH9+PcghgP9D8jluBHWUny5XjkkQ1IlUKCy7 3Sq56npRX4WwXx8lDbc1KK3QNj/Xsw7aL2GQOOLBvSVT+UujZhPBPlpmzUZf3aEwkkyq HFdqhc8TPHL+Vth7Dk5CJ5sW8DC6BwI02MOKfO9MVjCRZEaFHEhY0BvVfTgPrI86amgp A2JyGXYuCtgz8ErdOziMpgV/k+dpZ9KNvuvYtYcBUC8xF/d1M1UGzMhEuFFs5TLOB+F9 pkQHE5pA/SDKz8fwXHOUobk6RzF1toq4oASAX6GdK0qqgbkNfIl/t1da34RUxhX7JHSy immA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:cc:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=7v5fLjT/xATA5H1cnss7CV3yLG4O0S3xdS1hKvYN7RU=; b=u4rCimLmclkZyB4pNf0S/vxtJMrw6gfvrvBwIn427Av7N9uIHxDvpUibY2i5hmVGuI Io0c4eVWr5j/WOIBXuK+D7GnM1Z/qEl3pNg68qJfQ6JuSPV8RApYuNX/3r1QKo1tONqO UDkAAGd5VNHVd5lVmKKnHqArCqz/ra6HOrquhjToYpxfbocwy87+ox2PpFcsG0OVNrZF dqkrsDtkN0WAAr5uVAywgecBtagW4GEPZ6h8zQ5Q5Sv8xNmrzVAooNZ4h6IQgU0A6b1x XaKouk+JT8vjkyBMddMZEG0ZwrM7ZViZ+uEGaJe2bR0qKf2UuLUkOFfA0pL8WHUhheMT YOQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=dKYRAIoY; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id n9-20020a05640205c900b0044615ee1b6fsi2038733edx.218.2022.11.23.00.52.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 00:52:28 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=dKYRAIoY; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AD6443853D4C for ; Wed, 23 Nov 2022 08:52:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AD6443853D4C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669193547; bh=7v5fLjT/xATA5H1cnss7CV3yLG4O0S3xdS1hKvYN7RU=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=dKYRAIoYpojOxBYhdClCwSbSX8vKrUN+AUHfEp9VasVLFr2HhMgKBDzFp5n144CLk bJPxAVzJWWsxf1IHk0chcxibvvue7VZG4nlus2bXVjJUAS5sa03b0NhOiDqoJD6woL cB8BkVUy0o0GlnuA4Y03CBbBhohKhabBUVwtcXlI= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 6C7CA385457E for ; Wed, 23 Nov 2022 08:51:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6C7CA385457E Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-246-gEWufq8wOjmFEEDX81gaMw-1; Wed, 23 Nov 2022 03:51:42 -0500 X-MC-Unique: gEWufq8wOjmFEEDX81gaMw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8C788811E84 for ; Wed, 23 Nov 2022 08:51:42 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.194.202]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4A41440C6EC5; Wed, 23 Nov 2022 08:51:42 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 2AN8pbsa2527522 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 23 Nov 2022 09:51:38 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 2AN8pbcX2527521; Wed, 23 Nov 2022 09:51:37 +0100 Date: Wed, 23 Nov 2022 09:51:36 +0100 To: David Malcolm Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] diagnostics: Fix selftest ICE in certain locales [PR107722] Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jakub Jelinek via Gcc-patches From: Jakub Jelinek Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750276294665638720?= X-GMAIL-MSGID: =?utf-8?q?1750276294665638720?= Hi! As reported in the PR, since special_fname_builtin () call has been introduced, the diagnostics code compares filename against _("") rather than "", which means that if self tests are performed with the string being translated, one self-test fails. The following patch fixes that. Bootstrapped/regtested on x86_64-linux and i686-linux (with normal C locale) and by the reporter in German, where it fixes the problem. Ok for trunk? 2022-11-22 Jakub Jelinek PR bootstrap/107722 * diagnostic.cc (test_diagnostic_get_location_text): Test special_fname_builtin () rather than "" and expect special_fname_builtin () concatenated with ":" for it. Jakub --- gcc/diagnostic.cc.jj 2022-11-15 22:57:18.215211107 +0100 +++ gcc/diagnostic.cc 2022-11-22 12:36:37.197764164 +0100 @@ -2593,7 +2593,10 @@ test_diagnostic_get_location_text () const char *old_progname = progname; progname = "PROGNAME"; assert_location_text ("PROGNAME:", NULL, 0, 0, true); - assert_location_text (":", "", 42, 10, true); + char *built_in_colon = concat (special_fname_builtin (), ":", (char *) 0); + assert_location_text (built_in_colon, special_fname_builtin (), + 42, 10, true); + free (built_in_colon); assert_location_text ("foo.c:42:10:", "foo.c", 42, 10, true); assert_location_text ("foo.c:42:9:", "foo.c", 42, 10, true, 0); assert_location_text ("foo.c:42:1010:", "foo.c", 42, 10, true, 1001);