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: 178036 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp7796541dys; Wed, 13 Dec 2023 06:04:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IFg4G7YunqBD8npUDT0wemZ6fXp9KRe1jmBHVy2YDb63IFVbAR8GU3WKMndL1DtZJPShx6x X-Received: by 2002:a05:6102:390b:b0:464:905f:cf4c with SMTP id e11-20020a056102390b00b00464905fcf4cmr6772256vsu.13.1702476270613; Wed, 13 Dec 2023 06:04:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702476270; cv=pass; d=google.com; s=arc-20160816; b=poxXOqSDQnUOFuugepDXO1JonK9tKi7yDcy7KOQ659/eixsxbjvcZNCpk0gemE5GMe Qc3O1ZOkoKOrhHlpHbET9Zq3UlkzIpr6pnHiyjr5JxPU4WFUL1qzGhCpPFD0lP3yU/uY yV3tiksL/Q3o+2Vc1HEtGY5AYa9ZQR1B/E7ycxSVRnljRuH2o+4mvI/Mmp4jwJRemh0p xkTcOBYsfj23uLn8af94iB3EX6LJv2XkbjNzZzLt/zL9dDO7CUyiVFwuey7WFRvV+RAo 3o3n1GS6rxD4VcVVqF3EYlebKfQwy1EETZFBOjK+BhHljktVvu7ItYoc2qECTzPHYYpD z+qw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=FLfeEjNeaek5sYK0HJaBIiqnbOkxTcypRt3Kg7dqlLU=; fh=sJ+2/4g29YdyXkoRrFZSpsL2zxijepB7X/1rB0LDDh8=; b=ZfO57mFlRyIk38t4HXtz8TJ+8ZN8L5ZUXnolPvzLm6kGsM1/CszOmU/C/ryWbt8wFW 0ZGJU6Hhi0qjP7/Y45tIjSVXaLiTnMErIIAVnhkYiPY9RPczfBu1vifwUT/Q6IyD5rjx m5rXdtGY5JTXECnFPJc1nDaSIqWum7Z8rQmFVGC7a+bOWidw/msHpFLUyK7fO/WwExIb XedAH5ZrYrZXpXaZqg57dllsFluT7gXxMfSo1zDNd7dsy/c0hmsV6I+H2bL1IVTx1ZBL bL6Ay5+C1fw/xQfclm7TcdnPahVOzz+KCdAAJyBinPLDZwsaQak6RyjGX0Ktmqjt1y1I Q8GA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TM6KDKxG; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id b20-20020a0561023a1400b004647e006c95si2308746vsu.211.2023.12.13.06.04.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 06:04:30 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TM6KDKxG; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A02BD38618B5 for ; Wed, 13 Dec 2023 12:32:34 +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+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785175757411868085 X-GMAIL-MSGID: 1785175757411868085 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]]