On Tue, 21 Nov 2023, Alexander Monakov wrote:

> I am concerned that if GCC ever learns to leave out the following access
> to 'this->foo', leaving tmp uninitialized, we will end up with:
> 
>       this->foo = 42;

Sorry, this store will be DSE'd out, of course, but my question stands.

Alexander

>       *this = { CLOBBER };
>       __valgrind_make_mem_undefined(this, sizeof *this);
>       int tmp(D);
>       return tmp(D); // uninitialized
> 
> and Valgrind will not report anything since the invalid load is optimized out.
> 
> With early instrumentation such optimization is not going to happen, since the
> builtin may modify *this.
> 
> Is my concern reasonable?
> 
> Thanks.
> Alexander

Reply via email to