PR fortran/51809
* class.c (gfc_find_derived_vtab): Mark __vtab and
__def_init as FL_VARIABLE not as FL_PARAMETER.
* expr.c (gfc_simplify_expr): Remove special
handling of __vtab.
* resolve.c (resolve_values): Ditto.
* trans-decl.c (gfc_get_symbol_decl): Mark __vtab
and __def_init as TREE_READONLY.
2012-01-16 Tobias Burnus <burnus@net-b.de>
PR fortran/51809
* gfortran.dg/use_20.f90: New
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@183219
138bc75d-0d04-0410-961f-
82ee72b054a4
+2012-01-16 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/51809
+ * class.c (gfc_find_derived_vtab): Mark __vtab and
+ __def_init as FL_VARIABLE not as FL_PARAMETER.
+ * expr.c (gfc_simplify_expr): Remove special
+ handling of __vtab.
+ * resolve.c (resolve_values): Ditto.
+ * trans-decl.c (gfc_get_symbol_decl): Mark __vtab
+ and __def_init as TREE_READONLY.
+
2012-01-16 Paul Thomas <pault@gcc.gnu.org>
* trans-array.c (gfc_trans_create_temp_array): In the case of a
{
gfc_get_symbol (name, ns, &vtab);
vtab->ts.type = BT_DERIVED;
- if (gfc_add_flavor (&vtab->attr, FL_PARAMETER, NULL,
+ if (gfc_add_flavor (&vtab->attr, FL_VARIABLE, NULL,
&gfc_current_locus) == FAILURE)
goto cleanup;
vtab->attr.target = 1;
def_init->attr.target = 1;
def_init->attr.save = SAVE_IMPLICIT;
def_init->attr.access = ACCESS_PUBLIC;
- def_init->attr.flavor = FL_PARAMETER;
+ def_init->attr.flavor = FL_VARIABLE;
gfc_set_sym_referenced (def_init);
def_init->ts.type = BT_DERIVED;
def_init->ts.u.derived = derived;
initialization expression, or we want a subsection. */
if (p->symtree->n.sym->attr.flavor == FL_PARAMETER
&& (gfc_init_expr_flag || p->ref
- || p->symtree->n.sym->value->expr_type != EXPR_ARRAY)
- && !p->symtree->n.sym->attr.vtab)
+ || p->symtree->n.sym->value->expr_type != EXPR_ARRAY))
{
if (simplify_parameter_variable (p, type) == FAILURE)
return FAILURE;
{
gfc_try t;
- if (sym->value == NULL || sym->attr.use_assoc)
+ if (sym->value == NULL)
return;
if (sym->value->expr_type == EXPR_STRUCTURE)
/* Make sure the types of derived parameters are consistent. This
type checking is deferred until resolution because the type may
refer to a derived type from the host. */
- if (sym->ts.type == BT_DERIVED && sym->value
+ if (sym->ts.type == BT_DERIVED
&& !gfc_compare_types (&sym->ts, &sym->value->ts))
{
gfc_error ("Incompatible derived type in PARAMETER at %L",
if (sym->attr.vtab
|| (sym->name[0] == '_' && strncmp ("__def_init", sym->name, 10) == 0))
- GFC_DECL_PUSH_TOPLEVEL (decl) = 1;
+ {
+ TREE_READONLY (decl) = 1;
+ GFC_DECL_PUSH_TOPLEVEL (decl) = 1;
+ }
return decl;
}
+2012-01-16 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/51809
+ * gfortran.dg/use_20.f90: New
+
2012-01-16 Jason Merrill <jason@redhat.com>
PR c++/51868
--- /dev/null
+! { dg-do compile }
+!
+! PR fortran/51809
+!
+! Contributed by Kacper Kowalik
+!
+module foo
+ implicit none
+
+ type foo_t
+ contains
+ procedure :: func_foo
+ end type foo_t
+
+contains
+
+ subroutine func_foo(this)
+ implicit none
+ class(foo_t), intent(in) :: this
+ end subroutine func_foo
+
+end module foo
+
+module bar
+ use foo, only: foo_t
+
+ implicit none
+
+ type, extends(foo_t) :: bar_t
+ contains
+ procedure :: func_bar
+ end type bar_t
+
+contains
+
+ subroutine func_bar(this)
+ use foo, only: foo_t ! <--- removing this line also fixes ICE
+ implicit none
+ class(bar_t), intent(in) :: this
+ end subroutine func_bar
+
+end module bar
+
+module merry_ICE
+ use foo, only: foo_t ! <------ change order to prevent ICE
+ use bar, only: bar_t ! <------ change order to prevent ICE
+end module merry_ICE
+
+! { dg-final { cleanup-modules "foo bar merry_ice" } }