C++ Logo

std-proposals

Advanced search

Re: [std-proposals] P2815 breaks all provenance-related optimizations

From: Thiago Macieira <thiago_at_[hidden]>
Date: Tue, 21 Feb 2023 22:57:59 -0800
On Tuesday, 21 February 2023 18:53:04 PST connor horman via Std-Proposals
wrote:
> Under the proposal, however,
> `opaque_operation` could observe that `&i` and `p` have the same *value
> representation*, which means that they must be equal (it may do so with
> defined behaviour in all executions, for example, by terminating if they
> are bytewise unequal).:

The compiler may assume that, since it knows &i and p can't be equal, no such
comparison took place, and therefore the implementation you're speaking of is
not what opaque_function did.

Slide 22 of the P2815 presentation (and why is this a presentation instead of
a paper?) adds
"if the analysis cannot prove that two pointers cannot alias, then it must
assume that they may alias."

The premise is the escape here. It says "if the analysis cannot prove the
pointers cannot alias", which is not the case here, because we know they
cannot alias, unless p is dangling and the comparison is spurious. If this is
what you're worried about, then there should be a clear exception for spurious
comparisons, in particular of stack variables.

Anyway, was P2815 adopted into the standard? I don't see any suggestions to
standards text change, so there's nothing really to adopt. It's a presentation
of someone's opinion.
-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DCAI Cloud Engineering

Received on 2023-02-22 06:58:01