When nonlocal goto lowering creates an artificial label it fails
to adjust its context.
PR middle-end/118325
* tree-nested.cc (convert_nl_goto_reference): Assign proper
context to generated artificial label.
* gcc.dg/pr118325.c: New testcase.
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-std=gnu17 -fchecking" } */
+
+void f(void*);
+
+void z()
+{
+ void g()
+ {
+ __label__ out;
+ int h(void) { goto out; }
+ f(h);
+ out:;
+ }
+ f(g);
+}
{
new_label = create_artificial_label (UNKNOWN_LOCATION);
DECL_NONLOCAL (new_label) = 1;
+ DECL_CONTEXT (new_label) = target_context;
*slot = new_label;
}
else