diff mbox series

Fix PR90901, debug-expr expansion of deleted labels

Message ID alpine.LSU.2.20.1906181014050.10704@zhemvz.fhfr.qr
State New
Headers show
Series Fix PR90901, debug-expr expansion of deleted labels | expand

Commit Message

Richard Biener June 18, 2019, 8:15 a.m. UTC
The following deals with
  (note/s 5 0 0 ("lab") NOTE_INSN_DELETED_LABEL 2)
appearing in DECL_RTL of LABEL_DECLs which expand_debug_expr doesn't
expect.  copy_rtx cannot deal with any notes so the following simply
treats NOTE_P DECL_RTL as if it was optimized away.

Bootstrap / regtest running on x86_64-unknown-linux-gnu.

Richard.

2019-06-18  Richard Biener  <rguenther@suse.de>

	PR debug/90900
	* cfgexpand.c (expand_debug_expr): Treat NOTE_P DECL_RTL
	as if optimized away.

	* gcc.dg/gomp/pr90900.c: New testcase.

Comments

Jakub Jelinek June 18, 2019, 8:34 a.m. UTC | #1
On Tue, Jun 18, 2019 at 10:15:45AM +0200, Richard Biener wrote:
> 
> The following deals with
>   (note/s 5 0 0 ("lab") NOTE_INSN_DELETED_LABEL 2)
> appearing in DECL_RTL of LABEL_DECLs which expand_debug_expr doesn't
> expect.  copy_rtx cannot deal with any notes so the following simply
> treats NOTE_P DECL_RTL as if it was optimized away.
> 
> Bootstrap / regtest running on x86_64-unknown-linux-gnu.
> 
> Richard.
> 
> 2019-06-18  Richard Biener  <rguenther@suse.de>
> 
> 	PR debug/90900
> 	* cfgexpand.c (expand_debug_expr): Treat NOTE_P DECL_RTL
> 	as if optimized away.
> 
> 	* gcc.dg/gomp/pr90900.c: New testcase.

LGTM, thanks.

	Jakub
diff mbox series

Patch

Index: gcc/cfgexpand.c
===================================================================
--- gcc/cfgexpand.c	(revision 272405)
+++ gcc/cfgexpand.c	(working copy)
@@ -4387,7 +4387,11 @@  expand_debug_expr (tree exp)
       op0 = DECL_RTL_IF_SET (exp);
 
       /* This decl was probably optimized away.  */
-      if (!op0)
+      if (!op0
+	  /* At least label RTXen are sometimes replaced by
+	     NOTE_INSN_DELETED_LABEL.  Any notes here are not
+	     handled by copy_rtx.  */
+	  || NOTE_P (op0))
 	{
 	  if (!VAR_P (exp)
 	      || DECL_EXTERNAL (exp)
Index: gcc/testsuite/gcc.dg/gomp/pr90900.c
===================================================================
--- gcc/testsuite/gcc.dg/gomp/pr90900.c	(nonexistent)
+++ gcc/testsuite/gcc.dg/gomp/pr90900.c	(working copy)
@@ -0,0 +1,11 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -g" } */
+
+void f (int a)
+{
+  void *x = &&lab;
+#pragma omp parallel
+  if (a)
+    { lab: __builtin_unreachable(); }
+  x;
+}