https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118094
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Severity|normal |enhancement
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So the transformation to remove the condition is not valid until
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf which was only
passed in October (see
https://gcc.gnu.org/pipermail/gcc/2024-October/244911.html also).
Because your version of my_void_memcpy is well defined for src,dst being
nullptr as long as size is 0. Before the referenced paper, it is undefined
behavior if src/dst were a nullptr even if size is 0.