public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-839] c/100625 - avoid building invalid labels in the GIMPLE FE
@ 2021-05-17 14:18 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2021-05-17 14:18 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:086882b1c8faa8f99f98a9219ccec42d89db50c2

commit r12-839-g086882b1c8faa8f99f98a9219ccec42d89db50c2
Author: Richard Biener <rguenther@suse.de>
Date:   Mon May 17 14:47:08 2021 +0200

    c/100625 - avoid building invalid labels in the GIMPLE FE
    
    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.

Diff:
---
 gcc/c/gimple-parser.c                   | 3 ++-
 gcc/testsuite/gcc.dg/gimplefe-error-9.c | 9 +++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/gcc/c/gimple-parser.c b/gcc/c/gimple-parser.c
index 3a6e72ef002..398e21631d9 100644
--- a/gcc/c/gimple-parser.c
+++ b/gcc/c/gimple-parser.c
@@ -1887,7 +1887,8 @@ c_parser_gimple_label (gimple_parser &parser, gimple_seq *seq)
   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;
 }
 
diff --git a/gcc/testsuite/gcc.dg/gimplefe-error-9.c b/gcc/testsuite/gcc.dg/gimplefe-error-9.c
new file mode 100644
index 00000000000..87014c1cbbf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gimplefe-error-9.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-fgimple" } */
+
+void __GIMPLE
+foo()
+{
+bb1:
+bb1:; /* { dg-error "duplicate" } */
+}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-17 14:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-17 14:18 [gcc r12-839] c/100625 - avoid building invalid labels in the GIMPLE FE Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).