]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
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:53:13 +0000 (20:53 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Tue, 15 Jan 2019 20:53:13 +0000 (20:53 +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: r267952

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

index 1a00f9411f8a34bbd54bed30d1445e6c0a6360e8..31610781d431f5f951e26638b0072539e77f7974 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-11  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/35031
index 345f790dcd07c213e0a913b03def30ffd883c7c2..31808703d4d8bbe7cde3b999005ffcf68aa2de6f 100644 (file)
@@ -14859,7 +14859,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 814a1e9d88eff4442bf672f5144a0dc71c41c1d7..c38575673f56b6bc88d4cf474769460c8f7deb73 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-13  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
        PR libfortran/88776
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