https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77760
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Alexandre Oliva from comment #3) > 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 > doesn't work when __clang__ is defined. That would be user's fault if __clang__ is defined even when it is not clang. > 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 then 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.