When duplicate labes are diagnosed, avoid building a GIMPLE_LABEL.
2021-05-17 Richard Biener <rguenther@suse.de>
PR c/100625
gcc/c/
* gimple-parser.c (c_parser_gimple_label): Avoid building
a GIMPLE label with NULL label decl.
gcc/testsuite/
* gcc.dg/gimplefe-error-9.c: New testcase.
gcc_assert (c_parser_next_token_is (parser, CPP_COLON));
c_parser_consume_token (parser);
tree label = define_label (loc1, name);
- gimple_seq_add_stmt_without_update (seq, gimple_build_label (label));
+ if (label)
+ gimple_seq_add_stmt_without_update (seq, gimple_build_label (label));
return;
}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-fgimple" } */
+
+void __GIMPLE
+foo()
+{
+bb1:
+bb1:; /* { dg-error "duplicate" } */
+}