aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/decl.c16
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/class_61.f9011
4 files changed, 27 insertions, 11 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index d0dd306..840eb8f 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2016-11-30 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/78573
+ * decl.c (build_struct): On error, return directly and do not build
+ class symbol.
+
2016-11-29 Tobias Burnus <burnus@net-b.de>
PR fortran/58175
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 21eaafe..411d496d 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -1850,7 +1850,6 @@ build_struct (const char *name, gfc_charlen *cl, gfc_expr **init,
{
gfc_state_data *s;
gfc_component *c;
- bool t = true;
/* F03:C438/C439. If the current symbol is of the same derived type that we're
constructing, it must have the pointer attribute. */
@@ -1952,7 +1951,7 @@ build_struct (const char *name, gfc_charlen *cl, gfc_expr **init,
{
gfc_error ("Pointer array component of structure at %C must have a "
"deferred shape");
- t = false;
+ return false;
}
}
else if (c->attr.allocatable)
@@ -1961,7 +1960,7 @@ build_struct (const char *name, gfc_charlen *cl, gfc_expr **init,
{
gfc_error ("Allocatable component of structure at %C must have a "
"deferred shape");
- t = false;
+ return false;
}
}
else
@@ -1970,20 +1969,15 @@ build_struct (const char *name, gfc_charlen *cl, gfc_expr **init,
{
gfc_error ("Array component of structure at %C must have an "
"explicit shape");
- t = false;
+ return false;
}
}
scalar:
if (c->ts.type == BT_CLASS)
- {
- bool t2 = gfc_build_class_symbol (&c->ts, &c->attr, &c->as);
+ return gfc_build_class_symbol (&c->ts, &c->attr, &c->as);
- if (t)
- t = t2;
- }
-
- return t;
+ return true;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index aeac71a..47e41fc 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2016-11-30 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/78573
+ * gfortran.dg/class_61.f90: New test case.
+
2016-11-29 David Malcolm <dmalcolm@redhat.com>
PR preprocessor/78569
diff --git a/gcc/testsuite/gfortran.dg/class_61.f90 b/gcc/testsuite/gfortran.dg/class_61.f90
new file mode 100644
index 0000000..207e1e8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/class_61.f90
@@ -0,0 +1,11 @@
+! { dg-do compile }
+!
+! PR 78573: [7 Regression] [OOP] ICE in resolve_component, at fortran/resolve.c:13405
+!
+! Contributed by Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de>
+
+program p
+ type t1
+ class(t2), pointer :: q(2) ! { dg-error "must have a deferred shape" }
+ end type
+end