re PR fortran/24643 (Unclassifiable statement on implicitly typed character substring)
authorTobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
Thu, 10 Nov 2005 21:49:29 +0000 (22:49 +0100)
committerTobias Schlüter <tobi@gcc.gnu.org>
Thu, 10 Nov 2005 21:49:29 +0000 (22:49 +0100)
fortran/
PR fortran/24643
* primary.c (match_varspec): Check for implicitly typed CHARACTER
variables before matching substrings.

testsuite/
PR fortran/24643
* gfortran.dg/implicit_6.f90, gfortran.dg/implicit_7.f90: New.

From-SVN: r106753

gcc/fortran/ChangeLog
gcc/fortran/primary.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/implicit_6.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/implicit_7.f90 [new file with mode: 0644]

index fbb487ef412a93f16d4cf240e28aae0b430e45da..fbedea28f87c5723973e618cfd43e9776be675c7 100644 (file)
@@ -1,3 +1,9 @@
+2005-11-10  Tobias Schl"uter  <tobias.schlueter@physik.uni-muenchen.de>
+
+       PR fortran/24643
+       * primary.c (match_varspec): Check for implicitly typed CHARACTER
+       variables before matching substrings.
+
 2005-11-09  Steven G. Kargl  <kargls@comcast.net>
 
        * trans-intrinsic.c: Typo in comment.
index e3e812795936180a5c42e27afd1451db917e7311..1cb5d231e4ff848cf6c9e5b661f8db4fb5ddf3f1 100644 (file)
@@ -1634,6 +1634,15 @@ match_varspec (gfc_expr * primary, int equiv_flag)
     }
 
 check_substring:
+  if (primary->ts.type == BT_UNKNOWN)
+    {
+      if (gfc_get_default_type (sym, sym->ns)->type == BT_CHARACTER)
+       {
+         gfc_set_default_type (sym, 0, sym->ns);
+         primary->ts = sym->ts;
+       }
+    }
+
   if (primary->ts.type == BT_CHARACTER)
     {
       switch (match_substring (primary->ts.cl, equiv_flag, &substring))
index 2a845c376da5fa30d88185500b7c93011267ee26..ec545ea1a979685e814808d920dbd8f203d52501 100644 (file)
@@ -1,3 +1,8 @@
+2005-11-10  Tobias Schl"uter  <tobias.schlueter@physik.uni-muenchen.de>
+
+       PR fortran/24643
+       * gfortran.dg/implicit_6.f90, gfortran.dg/implicit_7.f90: New.
+
 2005-11-10  Alexandre Oliva  <aoliva@redhat.com>
 
        * gcc.dg/attr-weakref-1.c: Add exit (0) to avoid spurious
diff --git a/gcc/testsuite/gfortran.dg/implicit_6.f90 b/gcc/testsuite/gfortran.dg/implicit_6.f90
new file mode 100644 (file)
index 0000000..bb7fe32
--- /dev/null
@@ -0,0 +1,8 @@
+! { dg-do compile }
+! PR 24643
+! substring references on implicitly typed CHARACTER variables didn't work
+        PROGRAM P
+        IMPLICIT CHARACTER*8 (Y)
+        YLOCAL='A'
+        YBTABLE=YLOCAL(1:2)
+        END
diff --git a/gcc/testsuite/gfortran.dg/implicit_7.f90 b/gcc/testsuite/gfortran.dg/implicit_7.f90
new file mode 100644 (file)
index 0000000..750d245
--- /dev/null
@@ -0,0 +1,7 @@
+! { dg-do compile }
+! PR 24643
+! This tests a case where the compiler used to ICE in an early
+! incarnation of the patch
+ylocal=1
+ybtable=ylocal(1:2)  ! { dg-error "Unclassifiable" }
+end