summaryrefslogtreecommitdiff
path: root/gcc/fortran/decl.c
diff options
context:
space:
mode:
authorSteven G. Kargl <kargl@gcc.gnu.org>2019-06-19 18:04:46 +0000
committerSteven G. Kargl <kargl@gcc.gnu.org>2019-06-19 18:04:46 +0000
commitc9935123aef8eac547cdd0e8b06811fc776a6b32 (patch)
treeb9bc470b02b25d6245435882c21c59a4da8ea708 /gcc/fortran/decl.c
parentee3aab6826f7dbfe0f1a509cb429f4a4d755f38b (diff)
downloadgcc-c9935123aef8eac547cdd0e8b06811fc776a6b32.tar.gz
re PR fortran/69398 ([OOP] ICE on class with duplicate dimension attribute specified)
2019-06-19 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/69398 * decl.c (attr_decl): Check for duplicate DIMENSION attribute for a CLASS entity. 2019-06-19 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/69398 * gfortran.dg/pr69398.f90: New test. From-SVN: r272481
Diffstat (limited to 'gcc/fortran/decl.c')
-rw-r--r--gcc/fortran/decl.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 5fc06e48f2d..7fcb60ab7ab 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -8372,6 +8372,15 @@ attr_decl1 (void)
to the first component, or '_data' field. */
if (sym->ts.type == BT_CLASS && sym->ts.u.derived->attr.is_class)
{
+ /* gfc_set_array_spec sets sym->attr not CLASS_DATA(sym)->attr. Check
+ for duplicate attribute here. */
+ if (CLASS_DATA(sym)->attr.dimension == 1 && as)
+ {
+ gfc_error ("Duplicate DIMENSION attribute at %C");
+ m = MATCH_ERROR;
+ goto cleanup;
+ }
+
if (!gfc_copy_attr (&CLASS_DATA(sym)->attr, &current_attr, &var_locus))
{
m = MATCH_ERROR;