https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124084

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #3)
>             std::memset(ptr, 0, sizeof(bool));
>             new (ptr) bool;
> 
> 
> The memset here is dead. the lifetime of bool starts after the new.
> 
> GCC 16 is correct here.
> 
> gem5 needs to be fixed.

Swapping around the memset and the new is a fix. But the C++ standard is clear
here that the lifetime of of type bool starts after the new operator and any
store before it is not considered.

Reply via email to