aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/resolve.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2013-01-04 20:50:15 +0000
committerPaul Thomas <pault@gcc.gnu.org>2013-01-04 20:50:15 +0000
commite4821cd8679ab65057ad7f48c2236be8ad3ed8b7 (patch)
tree9a2cd2947d0ca61ecfb9528b1ee3dc7d2183d477 /gcc/fortran/resolve.c
parentad8c59a1b9c665496a01871b5e21500d8945ac3f (diff)
downloadgcc-e4821cd8679ab65057ad7f48c2236be8ad3ed8b7.zip
gcc-e4821cd8679ab65057ad7f48c2236be8ad3ed8b7.tar.gz
gcc-e4821cd8679ab65057ad7f48c2236be8ad3ed8b7.tar.bz2
re PR fortran/55172 ([OOP] gfc_variable_attr(): Bad array reference in SELECT TYPE)
2013-01-04 Paul Thomas <pault@gcc.gnu.org> PR fortran/55172 * match.c (copy_ts_from_selector_to_associate): Remove call to gfc_resolve_expr and replace it with explicit setting of the array reference type. * resolve.c (resolve_select_type): It is an error if the selector is coindexed. 2013-01-04 Paul Thomas <pault@gcc.gnu.org> PR fortran/55172 * gfortran.dg/select_type_31.f03: New test. From-SVN: r194916
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r--gcc/fortran/resolve.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 873400a..54ac3c6 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -1,6 +1,6 @@
/* Perform type resolution on the various structures.
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
- 2010, 2011, 2012
+ 2010, 2011, 2012, 2013
Free Software Foundation, Inc.
Contributed by Andy Vaught
@@ -8349,9 +8349,27 @@ resolve_select_type (gfc_code *code, gfc_namespace *old_ns)
if (code->expr1->symtree->n.sym->attr.untyped)
code->expr1->symtree->n.sym->ts = code->expr2->ts;
selector_type = CLASS_DATA (code->expr2)->ts.u.derived;
+
+ /* F2008: C803 The selector expression must not be coindexed. */
+ if (gfc_is_coindexed (code->expr2))
+ {
+ gfc_error ("Selector at %L must not be coindexed",
+ &code->expr2->where);
+ return;
+ }
+
}
else
- selector_type = CLASS_DATA (code->expr1)->ts.u.derived;
+ {
+ selector_type = CLASS_DATA (code->expr1)->ts.u.derived;
+
+ if (gfc_is_coindexed (code->expr1))
+ {
+ gfc_error ("Selector at %L must not be coindexed",
+ &code->expr1->where);
+ return;
+ }
+ }
/* Loop over TYPE IS / CLASS IS cases. */
for (body = code->block; body; body = body->block)