On Feb 17 2023, Alejandro Colomar via Gcc wrote:

> C2x (N3054 is the latest I know):
>
> If a pointer value is used in an evaluation after
> the object the pointer points to (or just past)
> reaches the end of its lifetime,
> the behavior is undefined.
> <https://www.open-std.org/JTC1/SC22/WG14/www/docs/n3054.pdf#subsection.6.2.4>
>
>
> This new wording doesn't even allow one to use memcmp(3);
> just reading the pointer value, however you do it, is UB.

But memcmp does not read the value, it reads the object representation,
and reading the representation is never UB.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

Reply via email to