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.129.124]) by sourceware.org (Postfix) with ESMTPS id 430EC3858C78 for ; Wed, 13 Dec 2023 12:31:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 430EC3858C78 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 430EC3858C78 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=p0+ND01T3YwVsQdTbTzbC0Xsx5X0j58Hk0UsMunlsMDZ54tNYeo8fAHNqeY0GZHrx3eiUvegJmBnvmEZJSyWjZ+HwxxpRs5myEH86qJ3edzxS5M+jwTV61G2e0bgZL/rKafPfh3Dfb/TdTZ9gKTXohog6d5jcJtdiIUxRFe7gAI= 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=vLm+YF1LiDB9vTD3szoF3PMSWoWsAYovOJJ3cGl8WdEkacAZU6eGVqDFrVnpvAG3vdsoLEgYW57eoiKy0R2ckeKJ7iss4kKH5zkcvh8SUhg9AwuM8M2LgxPLUcrP7WpDyTZQw1IFkagcW9bk01tpzYMzB+HHg1IP1rka7qTWz8Q= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702470705; 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=Ay7RhC3p+/4rrdt9y+oRzuZ5bruueo2GX7bl4DrpaFXLDxC51+wc0X7Q/e9MMPG3LA3gwy OYe+9Kb0rvlBHubzByON8DYAPVH6yWj5qit6cvPVSTDe8PJNuXxjxDu20XI0abnEGqMR/0 pRyCONdSqxb7MoRgz1AGDFEMWNYpQSM= 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 Content-Type: text/plain Content-Transfer-Encoding: 8bit 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 List-Id: 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]] -- 2.43.0