aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorAsher Langton <langton2@llnl.gov>2006-06-22 18:30:18 +0000
committerAsher Langton <langton@gcc.gnu.org>2006-06-22 18:30:18 +0000
commit5270c302f0ef520b9f6f96a1c94caa5962754401 (patch)
tree8305c361f234badfe3ead042bf6a015cb6dea8cd /gcc/fortran
parent752c5e547d44cb973eb70f8ec2158107c0f0dc97 (diff)
downloadgcc-5270c302f0ef520b9f6f96a1c94caa5962754401.zip
gcc-5270c302f0ef520b9f6f96a1c94caa5962754401.tar.gz
gcc-5270c302f0ef520b9f6f96a1c94caa5962754401.tar.bz2
re PR fortran/24748 (substring of implicitly typed variable not rejected)
PR fortran/24748 * primary.c (gfc_match_rvalue): Don't call match_substring for implicit non-character types. PR fortran/24748 * gfortran.dg/implicit_8.f90: New. From-SVN: r114901
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/primary.c16
2 files changed, 21 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 55e66cd..a02bebd 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2006-06-22 Asher Langton <langton2@llnl.gov>
+
+ PR fortran/24748
+ * primary.c (gfc_match_rvalue): Don't call match_substring for
+ implicit non-character types.
+
2006-06-22 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR libfortran/26769
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c
index 8fe1294..ad569fc 100644
--- a/gcc/fortran/primary.c
+++ b/gcc/fortran/primary.c
@@ -1912,6 +1912,8 @@ gfc_match_rvalue (gfc_expr ** result)
gfc_expr *e;
match m, m2;
int i;
+ gfc_typespec *ts;
+ bool implicit_char;
m = gfc_match_name (name);
if (m != MATCH_YES)
@@ -2156,10 +2158,22 @@ gfc_match_rvalue (gfc_expr ** result)
if (m2 != MATCH_YES)
{
+ /* Try to figure out whether we're dealing with a character type.
+ We're peeking ahead here, because we don't want to call
+ match_substring if we're dealing with an implicitly typed
+ non-character variable. */
+ implicit_char = false;
+ if (sym->ts.type == BT_UNKNOWN)
+ {
+ ts = gfc_get_default_type (sym,NULL);
+ if (ts->type == BT_CHARACTER)
+ implicit_char = true;
+ }
+
/* See if this could possibly be a substring reference of a name
that we're not sure is a variable yet. */
- if ((sym->ts.type == BT_UNKNOWN || sym->ts.type == BT_CHARACTER)
+ if ((implicit_char || sym->ts.type == BT_CHARACTER)
&& match_substring (sym->ts.cl, 0, &e->ref) == MATCH_YES)
{