https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110052
--- Comment #5 from Alexander Monakov <amonakov at gcc dot gnu.org> --- There are other reasons why it's invalid. For instance, in a multi-threaded program it could introduce a data race on assignment to foo->size inside of 'myrealloc' where the original program might have aborted without invoking UB. Can you give more context about the problem you're trying to solve?