https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80617
--- Comment #9 from Marc Glisse <glisse at gcc dot gnu.org> --- The testcases from comment #6 and comment #7 are now (gcc-8) properly optimized. The original has lost one of the 2 calls to free, one remains: __old_val_4 = MEM[(void * &)a_2(D)]; MEM[(void * &)a_2(D)] = 0B; __old_val_5 = MEM[(void * &)b_3(D)]; MEM[(void * &)b_3(D)] = 0B; MEM[(void * &)a_2(D)] = __old_val_5; _6 = MEM[(void * &)b_3(D)]; MEM[(void * &)b_3(D)] = __old_val_4; if (_6 != 0B) (whether a is the same as b or disjoint, _6 is always 0, but that's not easy to see)