https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101347
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Alexander Monakov <amona...@gcc.gnu.org>: https://gcc.gnu.org/g:daa36cfc2fc2538810db071b81d250f4d621f7ea commit r13-1766-gdaa36cfc2fc2538810db071b81d250f4d621f7ea Author: Alexander Monakov <amona...@ispras.ru> Date: Tue Jul 19 18:04:30 2022 +0300 Avoid registering __builtin_setjmp_receiver label twice [PR101347] The testcase in the PR demonstrates how it is possible for one __builtin_setjmp_receiver label to appear in nonlocal_goto_handler_labels list twice (after the block with __builtin_setjmp_setup referring to it was duplicated). remove_node_from_insn_list did not account for this possibility and removed only the first copy from the list. Add an assert verifying that duplicates are not present. To avoid adding a label to the list twice, move registration of the label from __builtin_setjmp_setup handling to __builtin_setjmp_receiver. gcc/ChangeLog: PR rtl-optimization/101347 * builtins.cc (expand_builtin) [BUILT_IN_SETJMP_SETUP]: Move population of nonlocal_goto_handler_labels from here ... (expand_builtin) [BUILT_IN_SETJMP_RECEIVER]: ... to here. * rtlanal.cc (remove_node_from_insn_list): Verify that a duplicate is not present in the remainder of the list.