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: 61017 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0B870385220C for ; Wed, 23 Nov 2022 08:52:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0B870385220C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669193533; 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=AGvXzTdEtBYJF8c0hf9PArro3wa9o4jILaaF+BP5giE4V5Uq1SVt2n1rmSNE9inrw 80juiv0jfN+3EOLUcN+yp6VgdgvxJtZNuxdoLpFbfh18+N+UJ9dXqlgVm1rVIiQgkC Ni/f1NWo01qyup5sBzi1zpCd+rD1vNIeSulE3LmQ= 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" 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);