https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64265
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Note, I don't see any kind of memory leak on any of the testcases. Sure, calling __tsan_func_entry many times is of course wrong. As for #c5, clang doesn't call __tsan_func_exit in that case either. Dmitry? If we were to call it even for exceptions, I'm afraid expanding this in tsan pass is too late, we'd need to add the __tsan_func_exit call say during gimplification as a cleanup of the whole body and then EH code would take care of adding the needed landing pads etc. But libtsan e.g. wraps longjmp and pops frames in there, not sure if it doesn't do something similar for exceptions already.