From patchwork Wed Dec 13 12:30:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1875618 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=TM6KDKxG; 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 4Sqvxz34jkz20LX for ; Wed, 13 Dec 2023 23:32:23 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 756943861003 for ; Wed, 13 Dec 2023 12:32:21 +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.129.124]) by sourceware.org (Postfix) with ESMTPS id 9C1D73858D39 for ; Wed, 13 Dec 2023 12:31:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9C1D73858D39 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 9C1D73858D39 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702470708; cv=none; b=OSA+KH43IzhZplaGfcIMyGw6KmrH9vodzxQnYjoDIg5mdaeqxouAZ67C5SKKHdBgoOPxdDJcn0Xxt2rzohgZOUK1v+8TcyIbh0iAR5Tt8RVgS3rEXME/B0/UQ6bcWGlwWyVmZQW2IEGQIgZ239RC1DNoJt1fIF/23yFMDQqFEWg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702470708; c=relaxed/simple; bh=LdJ2omBsgl3qY5O3I5M7t4QSZWR47TU5/MwqikqZKWk=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=K/NAAd1JlHlDVQ1xO9INdGC66xPuzc3z7pC1bppVJMmFMOu4ezFcwXCbvqTOlBwHM1vFPrFKDoJYi2xRhxXzHjVYEte7CPQ/QkadJGzGiWG0ONw6psJ0ho+hEkOE2FIkCCZNXtc4x7U9WdTjoCWZtk2uadx6Yg89Yii/X+lqcIg= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702470703; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FLfeEjNeaek5sYK0HJaBIiqnbOkxTcypRt3Kg7dqlLU=; b=TM6KDKxGLh59aKO6QVKOwNUoXgC0hXTpp7BjEhCPC5dCiANKIpeHZD4PK2QscxPPHxC6Z8 /HCwGeXY34S6Qp8SmQC/iqkSThMfFwETeeKx/Zpl+IroOm2Io51UTVwzrUOVdEwg37gP52 F6AwWWop9uyVXbtH/+qL+j3+vmWpR4s= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-629-8eiYFck-M5GMsUtr0OWcDg-1; Wed, 13 Dec 2023 07:31:41 -0500 X-MC-Unique: 8eiYFck-M5GMsUtr0OWcDg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id A1833101A551; Wed, 13 Dec 2023 12:31:41 +0000 (UTC) Received: from localhost (unknown [10.42.28.145]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6BAC02166B31; Wed, 13 Dec 2023 12:31:41 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Fix regression in std::format output of %Y for negative years Date: Wed, 13 Dec 2023 12:30:35 +0000 Message-ID: <20231213123140.1610945-1-jwakely@redhat.com> In-Reply-To: <20231212224654.1518338-1-jwakely@redhat.com> References: <20231212224654.1518338-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.8 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 It seems that what I pushed didn't match what I tested, due to testing on a different machine! Tested x86_64-linux, on the right machine this time. Pushed to trunk. -- >8 -- The change in r14-6468-ga01462ae8bafa8 was only supposed to apply to %C formats, not %Y. libstdc++-v3/ChangeLog: * include/bits/chrono_io.h (__formatter_chrono::_M_C_y_Y): Do not round century down for %Y formats. --- libstdc++-v3/include/bits/chrono_io.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libstdc++-v3/include/bits/chrono_io.h b/libstdc++-v3/include/bits/chrono_io.h index b63b8592eba..bcd76e4ab7b 100644 --- a/libstdc++-v3/include/bits/chrono_io.h +++ b/libstdc++-v3/include/bits/chrono_io.h @@ -825,7 +825,7 @@ namespace __format { __s.assign(1, _S_plus_minus[1]); // For floored division -123//100 is -2 and -100//100 is -1 - if ((__ci * 100) != __yi) + if (__conv == 'C' && (__ci * 100) != __yi) ++__ci; } if (__ci >= 100) [[unlikely]]