https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122835
--- Comment #22 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <[email protected]>: https://gcc.gnu.org/g:f68fe3ddda40d4c238095ff8c76c473b0d1e4827 commit r16-5623-gf68fe3ddda40d4c238095ff8c76c473b0d1e4827 Author: Jakub Jelinek <[email protected]> Date: Wed Nov 26 11:05:42 2025 +0100 eh: Invoke cleanups/destructors in asm goto jumps [PR122835] The eh pass lowers try { } finally { } stmts and handles in there e.g. GIMPLE_GOTOs or GIMPLE_CONDs which jump from within the try block out of that by redirecting the jumps to an artificial label with code to perform the cleanups/destructors and then continuing the goto, ultimately to the original label. Now, for computed gotos and non-local gotos, we document we don't invoke destructors (and cleanups as well), that is something we really can't handle, similarly longjmp. This PR is about asm goto though, and in that case I don't see why we shouldn't be performing the cleanups, while the user doesn't specify which particular label will be jumped to, so it is more like GIMPLE_COND (i.e. conditional goto) rather than unconditional GIMPLE_GOTO, even with potentiall more different maybe gotos, there is still list of the potential labels and we can adjust some or all of them to artificial labels performing cleanups and continuing jump towards the user label, we know from where the jumps go (asm goto) and to where (the different LABEL_DECLs). So, the following patch handles asm goto in the eh pass similarly to GIMPLE_COND and GIMPLE_GOTO. 2025-11-26 Jakub Jelinek <[email protected]> PR middle-end/122835 * tree-eh.cc (replace_goto_queue_1): Handle GIMPLE_ASM. (maybe_record_in_goto_queue): Likewise. (lower_eh_constructs_2): Likewise. * gcc.dg/torture/pr122835.c: New test.
