From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BA2023858C2D; Thu, 9 Feb 2023 08:50:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BA2023858C2D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1675932606; bh=gKp69NaXZH3kiP/VkSbJD8L1FAQ3CGZRk+xikBuGU5Q=; h=From:To:Subject:Date:In-Reply-To:References:From; b=m+Rp071eXef7Vk/PksgZAwxrV6s+kTb46PHeXhtT7jiNxI3RgEdTdAyfGe+4kofMW 666B6h7+h/9C2OYBlEQs5Gvg48sl+wmFQnW/bHux1Qr3P8obuAYApy9NkkXyKumspy Sr35TQfazK9spRT9Z8NPC/2mFXbupdgMEv4dp3C4= From: "aoliva at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/77760] get_time needs to set tm_wday amd tm_yday Date: Thu, 09 Feb 2023 08:50:06 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 7.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: aoliva at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D77760 Alexandre Oliva changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |aoliva at gcc dot gnu.org --- Comment #3 from Alexandre Oliva --- I'm looking at a case in which __clang__ is defined, despite compiling with GCC, and "%I...%p" parsing fails because the hack to pass state around does= n't work when __clang__ is defined. This got me thinking that there are more than enough bits in struct tm to encode all of __time_get_state in it, even with redundancy, so that overwri= tten fields could get recovered. I'm thinking that, before calling do_get, get would transfer its state onto struct tm in such a recoverable way, and, aft= er calling it, it would restore state from struct tm and remove the extra out-of-range encodings. Our do_get, in turn, would extract state from stru= ct tm, do its current job, and then pack the state back into struct tm. AFAICT this could be put in in an ABI-compatible way, dropping the hack and enabling libstdc++-specific do_get specializations to deal with such extend= ed states, should we document them. Has anything along these lines already been considered and ruled out?=