https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120677
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- The problem is obvious: gimple_stmt_iterator si = gsi_start_bb (output_crc->bb); gsi_insert_before (&si, call, GSI_SAME_STMT); This will insert before labels. I am not in front of computer to recommend the correct sequence though to insert at the beginning of the bb but after labels.