From: Andre Vehreschild Date: Thu, 19 Jan 2017 15:52:32 +0000 (+0100) Subject: re PR fortran/70696 ([Coarray] ICE on EVENT POST of host-associated EVENT_TYPE coarray) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=118d5ed3212800810ad6c09c1e51649a02d4caf3;p=gcc.git re PR fortran/70696 ([Coarray] ICE on EVENT POST of host-associated EVENT_TYPE coarray) gcc/fortran/ChangeLog: 2017-01-19 Andre Vehreschild PR fortran/70696 * trans-decl.c (gfc_build_qualified_array): Add static decl to parent function only, when the decl-context is not the translation unit. gcc/testsuite/ChangeLog: 2017-01-19 Andre Vehreschild PR fortran/70696 * gfortran.dg/coarray_43.f90: New test. From-SVN: r244637 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 17c419f4ff9..ca6ac2a9bd9 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2017-01-19 Andre Vehreschild + + PR fortran/70696 + * trans-decl.c (gfc_build_qualified_array): Add static decl to parent + function only, when the decl-context is not the translation unit. + 2017-01-18 Louis Krupp PR fortran/50069 diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 51c23e8c5df..5d246cd5624 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/ChangeLog b/gcc/testsuite/ChangeLog index dc54c0ae788..e0e0bd5432b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-01-19 Andre Vehreschild + + PR fortran/70696 + * gfortran.dg/coarray_43.f90: New test. + 2017-01-19 Richard Earnshaw PR rtl-optimization/79121 diff --git a/gcc/testsuite/gfortran.dg/coarray_43.f90 b/gcc/testsuite/gfortran.dg/coarray_43.f90 new file mode 100644 index 00000000000..d5ee4e1a668 --- /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