From aa61ac43e06d21a48d25da62ece852b2fc60d7f2 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 18 Jun 2019 13:56:24 +0000 Subject: [PATCH] re PR debug/90900 (ICE in copy_rtx, at rtl.c:376) 2019-06-18 Richard Biener PR debug/90900 * cfgexpand.c (expand_debug_expr): Treat NOTE_P DECL_RTL as if optimized away. * gcc.dg/gomp/pr90900.c: New testcase. From-SVN: r272421 --- gcc/ChangeLog | 6 ++++++ gcc/cfgexpand.c | 6 +++++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/gomp/pr90900.c | 11 +++++++++++ 4 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/gomp/pr90900.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cdfaa5fbf23..461792c3b29 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-06-18 Richard Biener + + PR debug/90900 + * cfgexpand.c (expand_debug_expr): Treat NOTE_P DECL_RTL + as if optimized away. + 2019-06-18 Tom de Vries * config/nvptx/nvptx-protos.h (gen_set_softstack_insn): Remove. diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 4272e24a700..cc8eed6181a 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cc5fecaf858..061f7fba453 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-06-18 Richard Biener + + PR debug/90900 + * gcc.dg/gomp/pr90900.c: New testcase. + 2019-06-18 Martin Sebor * gcc.dg/pr90866-2.c: Remove a pointless declaration diff --git a/gcc/testsuite/gcc.dg/gomp/pr90900.c b/gcc/testsuite/gcc.dg/gomp/pr90900.c new file mode 100644 index 00000000000..d4c5d7d5bef --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/pr90900.c @@ -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; +} -- 2.30.2