re PR fortran/81849 (Size of automatic array argument specified by host-associated...
authorSteven G. Kargl <kargl@gcc.gnu.org>
Tue, 15 Jan 2019 20:17:35 +0000 (20:17 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Tue, 15 Jan 2019 20:17:35 +0000 (20:17 +0000)
2019-01-15  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/81849
* resolve.c (resolve_symbol): Host associated varaibles can appear
in the specification statement of a RESULT array.

2019-01-15  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/81849
* gfortran.dg/pr81849.f90: New test.

From-SVN: r267948

gcc/fortran/ChangeLog
gcc/fortran/resolve.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr81849.f90 [new file with mode: 0644]

index a8cb6dd505f2dffcb0061b4834dc32ecb06f6c4c..76a840db8646d641aaa5e0025d82f2cffe3876ca 100644 (file)
@@ -1,3 +1,9 @@
+2019-01-15  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/81849
+       * resolve.c (resolve_symbol): Host associated varaibles can appear
+       in the specification statement of a RESULT array.
+
 2019-01-15  Paul Thomas  <pault@gcc.gnu.org>
 
        * trans-expr.c (gfc_conv_gfc_desc_to_cfi_desc): Deal with exprs
index 155e7c921cf2135ba5134448340764cd007b7f2e..7fbfa6935267fb792331f44feeb6a93757215af0 100644 (file)
@@ -15345,7 +15345,7 @@ resolve_symbol (gfc_symbol *sym)
   /* Set the formal_arg_flag so that check_conflict will not throw
      an error for host associated variables in the specification
      expression for an array_valued function.  */
-  if (sym->attr.function && sym->as)
+  if ((sym->attr.function || sym->attr.result) && sym->as)
     formal_arg_flag = true;
 
   saved_specification_expr = specification_expr;
index d38a5783686e874d190cfbb14301e454c3e7facd..56265c8641ba61db47f57d8060b67eac18e634d4 100644 (file)
@@ -1,3 +1,8 @@
+2019-01-15  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/81849
+       * gfortran.dg/pr81849.f90: New test.
+
 2019-01-15  Paul Thomas  <pault@gcc.gnu.org>
 
        * gfortran.dg/ISO_Fortran_binding_2.c : Change reference to
diff --git a/gcc/testsuite/gfortran.dg/pr81849.f90 b/gcc/testsuite/gfortran.dg/pr81849.f90
new file mode 100644 (file)
index 0000000..e2f2d6f
--- /dev/null
@@ -0,0 +1,16 @@
+! { dg-do run }
+! PR fortran/81849
+program p
+   implicit none
+   integer  :: n=3
+   if (any(g() /= f())) stop 1
+   contains
+      function g()
+         real g(n)
+         g = 7
+      end function g
+      function f() result(r)
+         real r(n)
+         r = 7
+      end function f
+end program