]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/87673 (Errors caused by using function for character length in allocate...
authorThomas Koenig <tkoenig@gcc.gnu.org>
Wed, 13 Mar 2019 22:15:33 +0000 (22:15 +0000)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Wed, 13 Mar 2019 22:15:33 +0000 (22:15 +0000)
2019-03-13  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/87673
Backport from trunk
* match.c (gfc_match_type_spec): Remove call to
gfc_resolve_expr for character length.

2019-03-13  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/87673
Backport from trunk
* gfortran.dg/charlen_17.f90: New test.

From-SVN: r269666

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

index 1346f4a5d36cd4ece89c05651a86c42e33230b40..7e6ca7007754b6b77cc2c4f6567b5e11539001b3 100644 (file)
@@ -1,3 +1,10 @@
+2019-03-13  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/87673
+       Backport from trunk
+       * match.c (gfc_match_type_spec): Remove call to
+       gfc_resolve_expr for character length.
+
 2019-03-10  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        PR fortran/71544
index 222c8d0068ed738f9584c9b8d05b19be799a7425..0200366d4ed16ecb4ebbfbed47e52319b26c241a 100644 (file)
@@ -2050,8 +2050,6 @@ gfc_match_type_spec (gfc_typespec *ts)
       ts->type = BT_CHARACTER;
 
       m = gfc_match_char_spec (ts);
-      if (ts->u.cl && ts->u.cl->length)
-       gfc_resolve_expr (ts->u.cl->length);
 
       if (m == MATCH_NO)
        m = MATCH_YES;
index ebde6c185aa136428f9c8158120961d0bfaf49a9..16636e13182c77a53338665ea9f082e1b170765f 100644 (file)
@@ -1,3 +1,9 @@
+2019-03-13  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/87673
+       Backport from trunk
+       * gfortran.dg/charlen_17.f90: New test.
+
 2019-03-13  Andre Vieira  <andre.simoesdiasvieira@arm.com>
 
        Backport from mainline
diff --git a/gcc/testsuite/gfortran.dg/charlen_17.f90 b/gcc/testsuite/gfortran.dg/charlen_17.f90
new file mode 100644 (file)
index 0000000..6b766d8
--- /dev/null
@@ -0,0 +1,14 @@
+! { dg-do compile }
+! PR 87673 - used to cause errors about non-pure functions.
+
+module x
+  implicit none
+contains
+  pure function foo() result(res)
+    character(len=:), allocatable :: res
+    allocate (character(bar()) :: res)
+  end function foo
+  pure integer function bar()
+    bar = 1
+  end function bar
+end module x