From patchwork Tue Aug 27 13:26:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1977321 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=dvjgcjBH; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WtSyB04dBz1yg0 for ; Tue, 27 Aug 2024 23:27:14 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 40F703860008 for ; Tue, 27 Aug 2024 13:27:12 +0000 (GMT) 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 EC9AB385DDFC for ; Tue, 27 Aug 2024 13:26:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EC9AB385DDFC Authentication-Results: sourceware.org; dmarc=pass (p=none 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 EC9AB385DDFC 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=1724765208; cv=none; b=nHV0haAZxw4dnv4STw5p23aDfgFT2/sxCmA/BcB+vMKqs/oqwa7sZhtGmBnl1X04TWnuf1xvOIUXCQd+dWkxF+O5mXRgBbltaHymvbO/oq0mJPGHnHZZXL2DSJgw7QxoiSdflSKAmQI1ZtwN1stollVM7H/QkSoG2lnYd5cvyCM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724765208; c=relaxed/simple; bh=42T450SntVuGfnLy9aUix8QhDGTKAK4hAHco3kZ2kac=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=oKXlL2N1sjgjh1Gyn6A1lEv8L9md8ty4KwXtjXYLuIhxwlQ7WMKC3SSmsyyklmYc6vm833iVwbN5jnZwqES2Hq2HTsSDzeYG5Y2/vuBbNUBRChtXJqlWq+sbcrHIk11lsCg0NdfqTTnBQzYsGGI05S9btaBIPYN/2vRXMuM6y08= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724765204; 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: in-reply-to:in-reply-to:references:references; bh=PLGEs0OQuzRPcrMo2n44dYX1RvAguENlYhZuwQHj09s=; b=dvjgcjBHfGtPmu/yNP5wsQPRd0nxW0FElfbG6FpmWnzt5kgAQOvfa/X6Z2MaE1x/50NjP8 c3DwDQoaztXVdp6lWKODP1+95tCv02mVqMIJVTbWIegUxwGLVu5b243BTlgonEV6HE8MmE TfRUB8OqV9lgsU/93mI0Tp1dtp0kLwQ= Received: from mx-prod-mc-05.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-190-6bo2OI4yMAiwm1UGU_hTow-1; Tue, 27 Aug 2024 09:26:42 -0400 X-MC-Unique: 6bo2OI4yMAiwm1UGU_hTow-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 68FF11954B23; Tue, 27 Aug 2024 13:26:40 +0000 (UTC) Received: from localhost (unknown [10.42.28.101]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7D01A19560AA; Tue, 27 Aug 2024 13:26:38 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Cc: Andrew Pinski Subject: [committed] libstdc++: Do not use std::vector::reference default ctor [PR115098] Date: Tue, 27 Aug 2024 14:26:05 +0100 Message-ID: <20240827132637.1531617-1-jwakely@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.0 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_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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~incoming=patchwork.ozlabs.org@gcc.gnu.org This default constructor was made private by r15-3124-gb25b101bc38000 so the pretty printer tests need a fix to stop using it. There's no conforming way to get a default-constructed 'reference' now, e.g. trying to access an element of a default-constructed std::vector will trigger an assertion. Remove the tests, but leave a comment in the printer code about handling it. libstdc++-v3/ChangeLog: PR libstdc++/115098 * python/libstdcxx/v6/printers.py (StdBitReferencePrinter): Add comment. * testsuite/libstdc++-prettyprinters/simple.cc: Do not default construct std::vector::reference. * testsuite/libstdc++-prettyprinters/simple11.cc: Likewise. --- libstdc++-v3/python/libstdcxx/v6/printers.py | 3 +++ libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc | 3 --- libstdc++-v3/testsuite/libstdc++-prettyprinters/simple11.cc | 3 --- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py index a6c2ed4599f..92104937862 100644 --- a/libstdc++-v3/python/libstdcxx/v6/printers.py +++ b/libstdc++-v3/python/libstdcxx/v6/printers.py @@ -613,6 +613,9 @@ class StdBitReferencePrinter(printer_base): def to_string(self): if not self._val['_M_p']: + # PR libstdc++/115098 removed the reference default constructor + # that this case relates to. New code should never need this, + # but we still handle it for compatibility with old binaries. return 'invalid std::vector::reference' return bool(self._val['_M_p'].dereference() & (self._val['_M_mask'])) diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc b/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc index 7bdc6548f72..c6d18d3fe03 100644 --- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc +++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc @@ -153,9 +153,6 @@ main() std::vector::reference br5 = *vbIt5; // { dg-final { note-test br5 {true} } } - std::vector::reference br0; -// { dg-final { note-test br0 {invalid std::vector::reference} } } - __gnu_cxx::slist sll; sll.push_front(23); sll.push_front(47); diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple11.cc b/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple11.cc index 3658e3ef4eb..7fd0c4d76b2 100644 --- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple11.cc +++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple11.cc @@ -146,9 +146,6 @@ main() std::vector::reference br5 = *vbIt5; // { dg-final { note-test br5 {true} } } - std::vector::reference br0; -// { dg-final { note-test br0 {invalid std::vector::reference} } } - __gnu_cxx::slist sll; sll.push_front(23); sll.push_front(47);