From 5c628c3e6f1af513a644fcdb7b18ef8945087e64 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 25 Jan 2017 09:48:10 +0000 Subject: [PATCH] re PR debug/78363 (ICE in in force_type_die, at dwarf2out.c:24864) 2017-01-25 Richard Biener PR debug/78363 * omp-expand.c: Include debug.h. (expand_omp_taskreg): Make sure to generate early debug before outlining anything from a function. (expand_omp_target): Likewise. (grid_expand_target_grid_body): Likewise. * g++.dg/gomp/pr78363-1.C: New testcase. * g++.dg/gomp/pr78363-2.C: Likewise. * g++.dg/gomp/pr78363-3.C: Likewise. From-SVN: r244892 --- gcc/ChangeLog | 9 +++++++++ gcc/omp-expand.c | 16 ++++++++++++++++ gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/g++.dg/gomp/pr78363-1.C | 14 ++++++++++++++ gcc/testsuite/g++.dg/gomp/pr78363-2.C | 15 +++++++++++++++ gcc/testsuite/g++.dg/gomp/pr78363-3.C | 14 ++++++++++++++ 6 files changed, 75 insertions(+) create mode 100644 gcc/testsuite/g++.dg/gomp/pr78363-1.C create mode 100644 gcc/testsuite/g++.dg/gomp/pr78363-2.C create mode 100644 gcc/testsuite/g++.dg/gomp/pr78363-3.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6c41705f50c..2ca39f06c26 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2017-01-25 Richard Biener + + PR debug/78363 + * omp-expand.c: Include debug.h. + (expand_omp_taskreg): Make sure to generate early debug before + outlining anything from a function. + (expand_omp_target): Likewise. + (grid_expand_target_grid_body): Likewise. + 2017-01-25 Maxim Ostapenko PR lto/79061 diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c index 1de3cd41a64..327c2e73d91 100644 --- a/gcc/omp-expand.c +++ b/gcc/omp-expand.c @@ -57,6 +57,7 @@ along with GCC; see the file COPYING3. If not see #include "gomp-constants.h" #include "gimple-pretty-print.h" #include "hsa-common.h" +#include "debug.h" /* OMP region information. Every parallel and workshare @@ -1305,6 +1306,11 @@ expand_omp_taskreg (struct omp_region *region) else block = gimple_block (entry_stmt); + /* Make sure to generate early debug for the function before + outlining anything. */ + if (! gimple_in_ssa_p (cfun)) + (*debug_hooks->early_global_decl) (cfun->decl); + new_bb = move_sese_region_to_fn (child_cfun, entry_bb, exit_bb, block); if (exit_bb) single_succ_edge (new_bb)->flags = EDGE_FALLTHRU; @@ -7016,6 +7022,11 @@ expand_omp_target (struct omp_region *region) gsi_remove (&gsi, true); } + /* Make sure to generate early debug for the function before + outlining anything. */ + if (! gimple_in_ssa_p (cfun)) + (*debug_hooks->early_global_decl) (cfun->decl); + /* Move the offloading region into CHILD_CFUN. */ block = gimple_block (entry_stmt); @@ -7589,6 +7600,11 @@ grid_expand_target_grid_body (struct omp_region *target) init_tree_ssa (cfun); pop_cfun (); + /* Make sure to generate early debug for the function before + outlining anything. */ + if (! gimple_in_ssa_p (cfun)) + (*debug_hooks->early_global_decl) (cfun->decl); + tree old_parm_decl = DECL_ARGUMENTS (kern_fndecl); gcc_assert (!DECL_CHAIN (old_parm_decl)); tree new_parm_decl = copy_node (DECL_ARGUMENTS (kern_fndecl)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d9921e6a4c6..65cae6f3837 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2017-01-25 Richard Biener + + PR debug/78363 + * g++.dg/gomp/pr78363-1.C: New testcase. + * g++.dg/gomp/pr78363-2.C: Likewise. + * g++.dg/gomp/pr78363-3.C: Likewise. + 2016-01-25 Kyrylo Tkachov * gcc.dg/lto/pr54709_0.c: Require 'shared' effective target. diff --git a/gcc/testsuite/g++.dg/gomp/pr78363-1.C b/gcc/testsuite/g++.dg/gomp/pr78363-1.C new file mode 100644 index 00000000000..7d89d0cdb51 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr78363-1.C @@ -0,0 +1,14 @@ +// { dg-do compile } +// { dg-require-effective-target c++11 } +// { dg-additional-options "-g" } + +int main() +{ + int n = 0; + +#pragma omp parallel for reduction (+: n) + for (int i = [](){ return 3; }(); i < 10; ++i) + n++; + + return n; +} diff --git a/gcc/testsuite/g++.dg/gomp/pr78363-2.C b/gcc/testsuite/g++.dg/gomp/pr78363-2.C new file mode 100644 index 00000000000..c04e0990c4f --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr78363-2.C @@ -0,0 +1,15 @@ +// { dg-do compile } +// { dg-require-effective-target c++11 } +// { dg-additional-options "-g" } + +int main() +{ + int n = 0; +#pragma omp target map(tofrom:n) +#pragma omp for reduction (+: n) + for (int i = [](){ return 3; }(); i < 10; ++i) + n++; + if (n != 7) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/g++.dg/gomp/pr78363-3.C b/gcc/testsuite/g++.dg/gomp/pr78363-3.C new file mode 100644 index 00000000000..265b9377a6c --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr78363-3.C @@ -0,0 +1,14 @@ +// { dg-do compile } +// { dg-require-effective-target c++11 } +// { dg-additional-options "-g" } + +int main() +{ + int n = 0; +#pragma omp task shared (n) + for (int i = [](){ return 3; }(); i < 10; ++i) + n = i; +#pragma omp taskwait + if (n != 7) + __builtin_abort (); +} -- 2.30.2