https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118325
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rguenth at gcc dot gnu.org Status|UNCONFIRMED |NEW Keywords| |ice-checking, | |needs-bisection Ever confirmed|0 |1 Last reconfirmed| |2025-01-07 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- t.c: In function āgā: t.c:5:10: error: label ā({anonymous})ā has incorrect context in bb 4 5 | void g() | ^ during GIMPLE pass: cfg t.c:5:10: internal compiler error: verify_flow_info failed Confirmed. "Works" with -fno-checking, might be introduced with the checking code itself but that's already ancient. Note we're complaining about an artifical label generated by create_artificial_label when current_function_decl is still 'z' during nested function lowering: #0 create_artificial_label (loc=0) at /space/rguenther/src/gcc/gcc/tree.cc:11829 #1 0x00000000019e9be1 in convert_nl_goto_reference (gsi=0x7fffffffd840, handled_ops_p=0x7fffffffd7cf, wi=0x7fffffffd980) at /space/rguenther/src/gcc/gcc/tree-nested.cc:2695 #2 0x000000000141f854 in walk_gimple_stmt (gsi=0x7fffffffd840, callback_stmt=0x19e9ac2 <convert_nl_goto_reference(gimple_stmt_iterator*, bool*, walk_stmt_info*)>, callback_op=0x0, wi=0x7fffffffd980) at /space/rguenther/src/gcc/gcc/gimple-walk.cc:618 #3 0x000000000141de18 in walk_gimple_seq_mod (pseq=0x7ffff6e0d820, callback_stmt=0x19e9ac2 <convert_nl_goto_reference(gimple_stmt_iterator*, bool*, walk_stmt_info*)>, callback_op=0x0, wi=0x7fffffffd980) at /space/rguenther/src/gcc/gcc/gimple-walk.cc:51 #4 0x000000000141f942 in walk_gimple_stmt (gsi=0x7fffffffd920, callback_stmt=0x19e9ac2 <convert_nl_goto_reference(gimple_stmt_iterator*, bool*, walk_stmt_info*)>, callback_op=0x0, wi=0x7fffffffd980) at /space/rguenther/src/gcc/gcc/gimple-walk.cc:645 the following fixes this particular testcase, but I bet coverage is very low. diff --git a/gcc/tree-nested.cc b/gcc/tree-nested.cc index d538c8d2a47..8d75a2f3310 100644 --- a/gcc/tree-nested.cc +++ b/gcc/tree-nested.cc @@ -2694,6 +2694,7 @@ convert_nl_goto_reference (gimple_stmt_iterator *gsi, bool *handled_ops_p, { new_label = create_artificial_label (UNKNOWN_LOCATION); DECL_NONLOCAL (new_label) = 1; + DECL_CONTEXT (new_label) = target_context; *slot = new_label; } else