Message ID | 20170119130750.5a36dd5a@vepi2 |
---|---|
State | New |
Headers | show |
On Thu, Jan 19, 2017 at 01:07:50PM +0100, Andre Vehreschild wrote: > Hi all, > > unfortunately triggered this patch a regression in the opencoarray's testsuite, > which also occurs outside of opencoarray, when a caf-function is used in a > block in the main-program. This patch fixes the error and adds a testcase. > > Bootstrapped and regtested ok on x86_64-linux/f25. Ok for trunk? > Yes.
Hi Steve, thanks for the review. Committed as r244637. Regards, Andre On Thu, 19 Jan 2017 06:51:19 -0800 Steve Kargl <sgk@troutmask.apl.washington.edu> wrote: > On Thu, Jan 19, 2017 at 01:07:50PM +0100, Andre Vehreschild wrote: > > Hi all, > > > > unfortunately triggered this patch a regression in the opencoarray's > > testsuite, which also occurs outside of opencoarray, when a caf-function is > > used in a block in the main-program. This patch fixes the error and adds a > > testcase. > > > > Bootstrapped and regtested ok on x86_64-linux/f25. Ok for trunk? > > > > Yes. >
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 51c23e8..5d246cd 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -971,7 +971,9 @@ gfc_build_qualified_array (tree decl, gfc_symbol * sym) DECL_CONTEXT (token) = sym->ns->proc_name->backend_decl; gfc_module_add_decl (cur_module, token); } - else if (sym->attr.host_assoc) + else if (sym->attr.host_assoc + && TREE_CODE (DECL_CONTEXT (current_function_decl)) + != TRANSLATION_UNIT_DECL) gfc_add_decl_to_parent_function (token); else gfc_add_decl_to_function (token); diff --git a/gcc/testsuite/gfortran.dg/coarray_43.f90 b/gcc/testsuite/gfortran.dg/coarray_43.f90 new file mode 100644 index 0000000..d5ee4e1 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/coarray_43.f90 @@ -0,0 +1,13 @@ +! { dg-do link } +! { dg-options "-fcoarray=lib -lcaf_single" } + +program coarray_43 + implicit none + integer, parameter :: STR_LEN = 50 + character(len=STR_LEN) :: str[*] + integer :: pos + write(str,"(2(a,i2))") "Greetings from image ",this_image()," of ",num_images() + block + pos = scan(str[5], set="123456789") + end block +end program