https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81744
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to amker from comment #4) > So with below code in prepare_finalizers_chain: > tree fini, niters = number_of_latch_executions (loop); > //... > niters = copy_node (niters); > niters = force_gimple_operand (niters, &stmts, true, NULL); > > Even with copy_node, the old niters (which is loop->nb_iterations is changed > by the call to force_gimple_operand. The code expects every time function > prepare_finalizers_chain is callsed, the niters/loop->nb_iterations stays in > the same. What should I do that? Thanks. copy_node copies only one level. force_gimple_operand, like other entrypoints to the gimplifier, are destructive on the tree you pass in, so if you want to reuse niters after it, you should use niters = unshare_expr (niters).