Commit a4f15a7d by Janus Weil

re PR fortran/78573 ([OOP] ICE in resolve_component, at fortran/resolve.c:13405)

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-30  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/78573
	* gfortran.dg/class_61.f90: New test case.

From-SVN: r242996
parent a195e177
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> 2016-11-29 Tobias Burnus <burnus@net-b.de>
PR fortran/58175 PR fortran/58175
......
...@@ -1850,7 +1850,6 @@ build_struct (const char *name, gfc_charlen *cl, gfc_expr **init, ...@@ -1850,7 +1850,6 @@ build_struct (const char *name, gfc_charlen *cl, gfc_expr **init,
{ {
gfc_state_data *s; gfc_state_data *s;
gfc_component *c; gfc_component *c;
bool t = true;
/* F03:C438/C439. If the current symbol is of the same derived type that we're /* F03:C438/C439. If the current symbol is of the same derived type that we're
constructing, it must have the pointer attribute. */ constructing, it must have the pointer attribute. */
...@@ -1952,7 +1951,7 @@ build_struct (const char *name, gfc_charlen *cl, gfc_expr **init, ...@@ -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 " gfc_error ("Pointer array component of structure at %C must have a "
"deferred shape"); "deferred shape");
t = false; return false;
} }
} }
else if (c->attr.allocatable) else if (c->attr.allocatable)
...@@ -1961,7 +1960,7 @@ build_struct (const char *name, gfc_charlen *cl, gfc_expr **init, ...@@ -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 " gfc_error ("Allocatable component of structure at %C must have a "
"deferred shape"); "deferred shape");
t = false; return false;
} }
} }
else else
...@@ -1970,20 +1969,15 @@ build_struct (const char *name, gfc_charlen *cl, gfc_expr **init, ...@@ -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 " gfc_error ("Array component of structure at %C must have an "
"explicit shape"); "explicit shape");
t = false; return false;
} }
} }
scalar: scalar:
if (c->ts.type == BT_CLASS) if (c->ts.type == BT_CLASS)
{ return gfc_build_class_symbol (&c->ts, &c->attr, &c->as);
bool t2 = gfc_build_class_symbol (&c->ts, &c->attr, &c->as);
if (t) return true;
t = t2;
}
return t;
} }
......
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> 2016-11-29 David Malcolm <dmalcolm@redhat.com>
PR preprocessor/78569 PR preprocessor/78569
......
! { 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment