From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669193504; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=7v5fLjT/xATA5H1cnss7CV3yLG4O0S3xdS1hKvYN7RU=; b=Z5zgT9yi8BPjr3MCYUSWHjsT5AWVaWu0f43muoJCKWbgSbAfTlxEUp3fphCCvj0PujXwt7 xUv8ssylAKK1mDf2JdGfo4unBcTaVXuaSMFQm/i6eV16tYYRBaUVRu6ybbxYmgD/7D44CY 15wQy+KY5hX1DdWUaQtvbVvbETAlCFA= 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 From: Jakub Jelinek To: David Malcolm Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] diagnostics: Fix selftest ICE in certain locales [PR107722] Message-ID: Reply-To: Jakub Jelinek 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-Type: text/plain; charset=us-ascii 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 List-Id: 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. --- 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); Jakub