[Bug c++/105864] storing nullptr_t to memory should not generate any instructions

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jun 13 13:18:05 GMT 2022


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |jason at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Reads from nullptr_t are replaced with just zero:
void foo (decltype(nullptr) *p) { *p = nullptr; }
decltype(nullptr) bar () { return nullptr; }
decltype(nullptr) baz (decltype(nullptr) *p) { return *p; }
so I don't see a reason why we couldn't omit the stores of nullptr_t, at least
with flag_strict_aliasing on.
Storing nullptr to another pointer type shouldn't be affected, the type of the
store then is that pointer type, not nullptr_t.  And passing nullptr to ...
isn't a store in the GENERIC or GIMPLE IL.


More information about the Gcc-bugs mailing list