Safe transposition of logical and operands
Floyd, Paul
paulf@free.fr
Mon Sep 18 14:46:47 GMT 2023
Hi Richard and Jonathan
On 18/09/2023 10:00, Richard Biener wrote:
> On Mon, Sep 18, 2023 at 9:24 AM Jonathan Wakely via Gcc<gcc@gcc.gnu.org> wrote:
>> Yes, GCC assumes that the reference is bound to a valid object, because C++
>> requires that to be true. Of course memcheck can't assume that, because one
>> of its main reasons to exist is to find undefined behaviour where that
>> isn't true!
It's even worse than that. This transformation is being done in VEX
(which unfortunately
is also the bit I know the least). Not normally where we'd do
accessibility checks.
>> I think what GCC is doing is a valid transformation, in the context of a
>> valid C++ program. But I'm not sure that helps valgrind, which doesn't have
>> the liberty of assuming a valid program.
> More specifically GCC thinks it's fine to speculate loads (given it can prove
> doing so doesn't trap)
I don't think that will be easy for us to prove. We just don't know
enough about stack variables.
A+
Paui
More information about the Gcc
mailing list