From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8283D385842C; Thu, 9 Feb 2023 09:08:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8283D385842C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1675933731; bh=4hfzGieQ5U5par4IN8kw/weGehTBR3n6xbSR3cdnicU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=jfNfMwajAvlg8GStRBcAThT5xm1iGDQbIMgE/td1uHck5NBJgAErrWMfwlZc8lpRw yccLMm29ypgw6N8ewkiztTackJTB2PP9Qj8TaaFWVQt5+Zorqy7F9QRZR3rMbDRlyI izQ3tjBOSCFMHmprSKgWjMUBv1tCKZB0UkkUhgIA= From: "jakub 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 09:08:50 +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: jakub 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: 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 --- Comment #4 from Jakub Jelinek --- (In reply to Alexandre Oliva from comment #3) > I'm looking at a case in which __clang__ is defined, despite compiling wi= th > GCC, and "%I...%p" parsing fails because the hack to pass state around > doesn't work when __clang__ is defined. That would be user's fault if __clang__ is defined even when it is not clan= g. > 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 But can we rely on that? I'm afraid not all users are clearing struct tm before calling the time_get methods, some are calling it with some members already initialized from something else (manually etc.) and others not initialized = at all, and depending on which format specifiers are used expect only some of the struct tm members = to be updated, not all of them. Say fill in manually hour/minute/second and t= hen parse just date, or vice versa. Which is why I've done the tracking of the state on the side rather than directly in it.=