https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113731
Tamar Christina <tnfchris at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2024-02-03 Ever confirmed|0 |1 Assignee|unassigned at gcc dot gnu.org |tnfchris at gcc dot gnu.org --- Comment #4 from Tamar Christina <tnfchris at gcc dot gnu.org> --- blah, gsi_move_before (&stmt_gsi, &dest_gsi); when dest_gsi is empty does not move the pointer. It's not mentioned in the description but in the function it eventually calls gsi_insert_before there's a comment /* If CUR is NULL, we link at the end of the sequence (this case happens so it adds it to the end instead of start like you asked. diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index 30b90d99925..e2587315020 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -11801,7 +11801,8 @@ move_early_exit_stmts (loop_vec_info loop_vinfo) gimple_stmt_iterator stmt_gsi = gsi_for_stmt (stmt); gsi_move_before (&stmt_gsi, &dest_gsi); - gsi_prev (&dest_gsi); + if (!gsi_end_p (dest_gsi)) + gsi_prev (&dest_gsi); } fixes it. the libarchive, is that also with -march=znver2? and is https://github.com/libarchive/libarchive?