> Don't you need to handle convert_nonlocal_omp_clauses similarly (need_chain
> in that case)?
> At least looking at your r211308 commit, for !optimize you force not just
> the frame, but also chain.
You're very likely right, although I didn't manage to write a Fortran testcase
with my limited knowledge of the language (I get a "Bad statement code" ICE).
In fact the conditions should also mimic those of the aforementioned commit.
I initially didn't realize it, because I didn't quite grasp how the GOMP stuff
was interacting with the nesting stuff, but I guess that the code ought not to
do anything if there aren't pre-existing nested functions in the sources.
Tested on x86_64-suse-linux, OK for the mainline and 5 branch?
2015-06-29 Eric Botcazou <ebotca...@adacore.com>
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-06-29 Eric Botcazou <ebotca...@adacore.com>
* gfortran.dg/gomp/pr66633.f90: New test.
--
Eric Botcazou
Index: tree-nested.c
===================================================================
--- tree-nested.c (revision 225111)
+++ tree-nested.c (working copy)
@@ -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;
! PR middle-end/66633
! Testcase by Andrew Benson <abenso...@gmail.com>
! { 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