Hi Anna,
thanks for your patch! I did not have to time look at this
(and I can't approve it), but here is something I noticed.
You have an error for jumping into a defer block
>
> @@ -4244,10 +4274,29 @@ check_earlier_gotos (tree label, struct c_label_vars*
> label_vars)
>
> if (g->goto_bindings.stmt_exprs.count > 0)
> {
> - auto_diagnostic_group d;
> error_at (g->loc, "jump into statement expression");
> inform (DECL_SOURCE_LOCATION (label), "label %qD defined here",
> - label);
> + label);
> + }
> +
> + if (g->goto_bindings.defer_blocks.count > 0)
> + {
> + error_at (g->loc, "jump into defer block");
> + inform (DECL_SOURCE_LOCATION (label), "label %qD defined here",
> + label);
> + }
> + else if (g->goto_bindings.defer_blocks.left)
But no tests for jumping into the defer from an earlier gotos.
> +
> +void d () {
> + defer {
> +b:
> + }
> + goto b; /* { dg-error "jump out of defer block" } */
> +}
And this should probably also be "jump into", but the goto
comes later.
Martin