|
From: | Lukas Javorsky |
Subject: | Re: Possible UNINIT bug within man-db gl sources |
Date: | Wed, 21 Aug 2024 08:55:17 +0200 |
On 2024-08-16 07:30, Bruno Haible wrote:
> Copying and then discarding an uninitialized value of integer
> or pointer type (i.e. not a signalling NaN (*)) is not undefined behaviour.
Although that's how typical implementations behave, the C standard says
that copying from a source variable has undefined behavior if the source
could have been declared with 'register' (i.e., it's auto and never has
its address taken). See C23 §6.3.2.1 paragraph 2. Since the code in
question is copying from such a source, its behavior is technically
undefined.
I recall running into a similar problem myself, when writing the mcel
code, though I don't recall the details.
Proposed patch attached. I daresay there's lots of other places that
would need a similar fix, assuming this one is acceptable.
Lukáš Javorský
Senior Software Engineer, Core service - Databases
Purkyňova 115 (TPB-C)
612 00 Brno - Královo Pole
[Prev in Thread] | Current Thread | [Next in Thread] |