https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95137
--- Comment #32 from Iain Sandoe <iains at gcc dot gnu.org> --- (In reply to Rafael Avila de Espindola from comment #31) > Hi Iain, > > Any update on this? If there is any way I can help, please let me know. It > has been a decade since I looked into gcc, but I should still be able to > test patches or implement small side changes. I was working on a wider problem, now need to re-analyze this. A quick look says we have a similar issue to one already solved (that was duplicate use of a dtor). When we switch sanitize off, the gimple generated correctly re-loads the this pointer for both the catch and finally clauses. When sanitize=undefined is on, it seems to conclude (incorrectly) that a temp loaded for the catch clause can be re-used for the finally clause. Not sure at present where the error is creeping in. (so from my quick test, your case passes without -fsanitize=undefined, the DTORs run correctly - no abort() .. and it fails with the sanitiser engaged because the DTOR gets a nonsense this ptr.