On 3/11/23 23:38, Paul Eggert wrote: > On 2023-03-11 13:59, Alejandro Colomar wrote: >> If the function is allowed >> to dereference, then NULL is not allowed, but if the values are >> uninitialized, then reading any of them should also trigger UB, no? > > Sure, but the standard says that strftime reads only the struct tm > members needed to interpret the format. If the format contains no > conversion specs, strftime reads no struct tm members and thus there is > no UB even if the struct tm is entirely uninitialized.
Yeah, my point then is that if you don't read members, you don't even need to dereference. However, I see that glibc takes a copy, which is a reason to dereference without reading any values. So, yes, you're right ;) -- <http://www.alejandro-colomar.es/> GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5
OpenPGP_signature
Description: OpenPGP digital signature