re PR fortran/70696 ([Coarray] ICE on EVENT POST of host-associated EVENT_TYPE coarray)
authorAndre Vehreschild <vehre@gcc.gnu.org>
Thu, 19 Jan 2017 15:52:32 +0000 (16:52 +0100)
committerAndre Vehreschild <vehre@gcc.gnu.org>
Thu, 19 Jan 2017 15:52:32 +0000 (16:52 +0100)
gcc/fortran/ChangeLog:

2017-01-19  Andre Vehreschild  <vehre@gcc.gnu.org>

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  <vehre@gcc.gnu.org>

PR fortran/70696
* gfortran.dg/coarray_43.f90: New test.

From-SVN: r244637

gcc/fortran/ChangeLog
gcc/fortran/trans-decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/coarray_43.f90 [new file with mode: 0644]

index 17c419f4ff9e10a0cf8fc66ce1f220d51382b46c..ca6ac2a9bd924b51a4660c5dffb940dac75961c9 100644 (file)
@@ -1,3 +1,9 @@
+2017-01-19  Andre Vehreschild  <vehre@gcc.gnu.org>
+
+       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  <louis.krupp@zoho.com>
 
        PR fortran/50069
index 51c23e8c5df910f01c5098f2e3a15f8ed82d1657..5d246cd5624f2f12aa4d5287c80fec7ae1394c2e 100644 (file)
@@ -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);
index dc54c0ae788a273785bfae4d731354417d381f29..e0e0bd5432b4054c1ea96e432b9162d1d831551e 100644 (file)
@@ -1,3 +1,8 @@
+2017-01-19  Andre Vehreschild  <vehre@gcc.gnu.org>
+
+       PR fortran/70696
+       * gfortran.dg/coarray_43.f90: New test.
+
 2017-01-19  Richard Earnshaw  <rearnsha@arm.com>
 
        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 (file)
index 0000000..d5ee4e1
--- /dev/null
@@ -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