aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorTobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>2005-11-10 22:49:29 +0100
committerTobias Schlüter <tobi@gcc.gnu.org>2005-11-10 22:49:29 +0100
commitc040ffff7577b6798465f6c025de2b1f77cec1e9 (patch)
tree175d54b20da14c63f04d177c7e4554d912932378 /gcc
parent5f4b73288dd35d516ff8a3b2b5ba19715beaaace (diff)
downloadgcc-c040ffff7577b6798465f6c025de2b1f77cec1e9.zip
gcc-c040ffff7577b6798465f6c025de2b1f77cec1e9.tar.gz
gcc-c040ffff7577b6798465f6c025de2b1f77cec1e9.tar.bz2
re PR fortran/24643 (Unclassifiable statement on implicitly typed character substring)
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/primary.c9
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/implicit_6.f908
-rw-r--r--gcc/testsuite/gfortran.dg/implicit_7.f907
5 files changed, 35 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index fbb487e..fbedea2 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -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.
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c
index e3e8127..1cb5d23 100644
--- a/gcc/fortran/primary.c
+++ b/gcc/fortran/primary.c
@@ -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))
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2a845c3..ec545ea 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..bb7fe32
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/implicit_6.f90
@@ -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
index 0000000..750d245
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/implicit_7.f90
@@ -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