From patchwork Wed Sep 17 20:47:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 120442 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 88CA33858D29 for ; Wed, 17 Sep 2025 20:50:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 88CA33858D29 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=d+5Q7236 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 ESMTP id BFAE43858C42 for ; Wed, 17 Sep 2025 20:47:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BFAE43858C42 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BFAE43858C42 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1758142060; cv=none; b=c5hoavvShluv48zfLP+QxkbgdPYLEP646ufZue6bdfLUKJLOKd9dBfblhiuC7xFl0EAKEigRZdEm2bD4fU5fPtMTH15bZbqxl6H1rIPYd3vy8gHkCw3ZyDhyEZ87/DEHkRVt3ss1Kun0Erh28PUiHM0BVdbZN5gznKTaFCe997o= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1758142060; c=relaxed/simple; bh=jkTDZBC+fTPGoXvETF+wIa1v7JnCly5nmZH5/GPud+Q=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Zer3QLDAJGNUZZETbCjXFwKm1+s7egLryqQhQyJyXP+skerTvJ2VSEI/ltkfEmTAA8VsaqQXhCED222DSUIEbv+E5/Cc3yxNLLf+qrXzGuU8kEQSG0Tri04fzM+19OAVPuequ8PVlRKc1Dq9ESx8juWFgFpDbyYuvM4MwKdmMps= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BFAE43858C42 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1758142060; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ks5ygyUTD+tXqbQimkOjFRAfKeK92ZFQmqCs/oZl/LM=; b=d+5Q7236VTn5fIV0Han1pySKJ6CZemMWlYHG5Al/NHR145cgldSuvAJMBp71zqWyA62nXw N6wYSDMSKYHhelCbZpYfyIgYioF2bnLGVhm4qqCPYo0BR8TFaH2pNy8M9gSJ7A1cT74WIQ fj+VGb3EYfrL/ki6ZQ7g29a5rF3oTxQ= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-670-cT4aVkZRMbGzId-JJsG5CQ-1; Wed, 17 Sep 2025 16:47:39 -0400 X-MC-Unique: cT4aVkZRMbGzId-JJsG5CQ-1 X-Mimecast-MFC-AGG-ID: cT4aVkZRMbGzId-JJsG5CQ_1758142058 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 65AC91956054 for ; Wed, 17 Sep 2025 20:47:38 +0000 (UTC) Received: from t14s.localdomain (unknown [10.22.81.11]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A58DB19560B1; Wed, 17 Sep 2025 20:47:37 +0000 (UTC) From: David Malcolm To: gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [pushed: r16-3940] c++: fix count of z candidates for non-viable candidates [PR121966] Date: Wed, 17 Sep 2025 16:47:35 -0400 Message-ID: <20250917204735.2386432-1-dmalcolm@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 9I6rYh7HPsuab1yBIVsgc4Ch6gMGlTOucfdprmSQwRE_1758142058 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_PASS, 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org In r15-6116-gd3dd24acd74605 I updated print_z_candidates to show the number of candidates, and a number for each candidate. PR c++/121966 notes that the printed count is sometimes higher than what's actually printed: I missed the case where candidates in the list aren't printed due to not being viable. Fixed thusly. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r16-3940-gc0b21d1f45ac6a. gcc/cp/ChangeLog: PR c++/121966 * call.cc (print_z_candidates): Copy the filtering logic on viable candidates from the printing loop to the counting loop, so that num_candidates matches the number of iterations of the latter loop. --- gcc/cp/call.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc index 02cef63a4538..d11961a48ada 100644 --- a/gcc/cp/call.cc +++ b/gcc/cp/call.cc @@ -4255,7 +4255,11 @@ print_z_candidates (location_t loc, struct z_candidate *candidates, int num_candidates = 0; for (auto iter = candidates; iter; iter = iter->next) - ++num_candidates; + { + if (only_viable_p.is_true () && iter->viable != 1) + break; + ++num_candidates; + } inform_n (loc, num_candidates, "there is %i candidate", "there are %i candidates",