The post has been updated, but the original version (https://web.archive.org/web/20221127072237/https://yurichev....) had a second bug:
struct tmp* m_result_original=...;
struct tmp* m_result_my_version=...;
... memcmp(&m_result_original, &m_result_my_version, ...)
The `&` must be dropped in the call to memcmp (which the author did in the current version).Ironically, GCC 12.2 warns about this error while clang doesn't :)
The warning message produced by GCC is "'memcmp(...)' specified bound 12 exceeds source size 8 [-Wstringop-overread]", and it is printed even without -Wall, but only when the third argument is `sizeof(struct tmp)` rather than `sizeof(struct tmp)!=0`.
But as @Stratoscope pointed out, memcmp() is still problematic if the struct has padding.