From eb71ab9f1fcfd23e7b3aef9a5659275bcd840f29 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Wed, 1 Jul 2015 08:21:40 +0000 Subject: [PATCH] re PR middle-end/66633 (ICE on valid "verify_gimple failed" with OpenMP) PR middle-end/66633 * tree-nested.c (convert_nonlocal_omp_clauses): Initialize need_chain to true if the function is nested and if not optimizing. (convert_local_omp_clauses): Initialize need_frame to true if the function contains nested functions and if not optimizing. From-SVN: r225227 --- gcc/ChangeLog | 8 ++++++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gfortran.dg/gomp/pr66633.f90 | 17 +++++++++++++++++ gcc/tree-nested.c | 8 ++++++-- 4 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/gomp/pr66633.f90 diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3f0ba84fc1b..abbdf464161 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2015-07-01 Eric Botcazou + + PR middle-end/66633 + * tree-nested.c (convert_nonlocal_omp_clauses): Initialize need_chain + to true if the function is nested and if not optimizing. + (convert_local_omp_clauses): Initialize need_frame to true if the + function contains nested functions and if not optimizing. + 2015-07-01 Richard Biener * fold-const.c (fold_binary_loc): Move ~X ^ X -> -1 and diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index aca88862aa9..8d53a61fc1e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-07-01 Eric Botcazou + + * gfortran.dg/gomp/pr66633.f90: New test. + 2015-07-01 Patrick Palka PR c++/66686 diff --git a/gcc/testsuite/gfortran.dg/gomp/pr66633.f90 b/gcc/testsuite/gfortran.dg/gomp/pr66633.f90 new file mode 100644 index 00000000000..60e47b3943a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/pr66633.f90 @@ -0,0 +1,17 @@ +! PR middle-end/66633 +! Testcase by Andrew Benson + +! { dg-do compile } +! { dg-options "-O0 -fopenmp" } + +module spls +contains + function spl() + !$omp parallel + write (0,*) igrt(fli) + !$omp end parallel + contains + double precision function fli() + end function fli + end function spl +end module spls diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c index f391c652f6f..6b9d753ee52 100644 --- a/gcc/tree-nested.c +++ b/gcc/tree-nested.c @@ -1069,7 +1069,9 @@ static bool convert_nonlocal_omp_clauses (tree *pclauses, struct walk_stmt_info *wi) { struct nesting_info *const info = (struct nesting_info *) wi->info; - bool need_chain = false, need_stmts = false; + /* If not optimizing, we will force the creation of the CHAIN object in + convert_all_function_calls, so we need to take it into account here. */ + bool need_chain = info->outer && !optimize, need_stmts = false; tree clause, decl; int dummy; bitmap new_suppress; @@ -1697,7 +1699,9 @@ static bool convert_local_omp_clauses (tree *pclauses, struct walk_stmt_info *wi) { struct nesting_info *const info = (struct nesting_info *) wi->info; - bool need_frame = false, need_stmts = false; + /* If not optimizing, we will force the creation of the FRAME object in + convert_all_function_calls, so we need to take it into account here. */ + bool need_frame = info->inner && !optimize, need_stmts = false; tree clause, decl; int dummy; bitmap new_suppress; -- 2.30.2