C++ Logo


Advanced search

Subject: Re: [ub] C provenance semantics proposal
From: Jens Maurer (Jens.Maurer_at_[hidden])
Date: 2019-04-12 14:48:14

On 11/04/2019 23.36, Uecker, Martin wrote:
> Am Donnerstag, den 11.04.2019, 15:07 -0600 schrieb Martin Sebor:
>>  You have several compiler writers/standards
>> people explaining it's by design in the bug reports you found.
> No. On the clang buf report there was no disagreement
> and the bug was fixed in commit r220343.

I can't comment on Clang's policy for addressing perceived bugs in
their code, but C++17 clearly says in [expr.eq] p2.1 for the
definition of ==:

"— If one pointer represents the address of a complete object, and another pointer
represents the address one past the last element of a different complete object,
the result of the comparison is unspecified."

This was added to address Core Issue 1652 "Object addresses in constexpr
expressions", and Richard Smith, the person fixing the Clang "bug", was
intimately involved in this change.

So, I'd say the current status in C++ is deliberate and at least
cognizant of the then-recent Clang bug report. Furthermore, C DR 260
"Implementations [...] may also treat pointers based on different origin
as distinct even though they are bitwise identical."

which seems to be consistent with the C++ "unspecified value"


SG12 list run by sg12-owner@lists.isocpp.org