+2016-11-12 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/77501
+ * class.c (gfc_find_typebound_intrinsic_op): Remove an unnecessary
+ assert and nullification.
+ * decl.c (gfc_match_decl_type_spec): Use gfc_get_tbp_symtree,
+ fix indentation.
+ (gfc_match_generic): Remove an unnecessary assert.
+ Use gfc_get_tbp_symtree to avoid ICE.
+
2016-11-10 Fritz O. Reese <fritzoreese@gmail.com>
PR fortran/78277
gfc_symtree*
gfc_get_tbp_symtree (gfc_symtree **root, const char *name)
{
- gfc_symtree *result;
-
- result = gfc_find_symtree (*root, name);
- if (!result)
- {
- result = gfc_new_symtree (root, name);
- gcc_assert (result);
- result->n.tb = NULL;
- }
-
- return result;
+ gfc_symtree *result = gfc_find_symtree (*root, name);
+ return result ? result : gfc_new_symtree (root, name);
}
upe->attr.zero_comp = 1;
if (!gfc_add_flavor (&upe->attr, FL_DERIVED, NULL,
&gfc_current_locus))
- return MATCH_ERROR;
- }
+ return MATCH_ERROR;
+ }
else
{
- st = gfc_find_symtree (gfc_current_ns->sym_root, "STAR");
- if (st == NULL)
- st = gfc_new_symtree (&gfc_current_ns->sym_root, "STAR");
+ st = gfc_get_tbp_symtree (&gfc_current_ns->sym_root, "STAR");
st->n.sym = upe;
upe->refs++;
}
gfc_symtree* st;
st = gfc_find_symtree (is_op ? ns->tb_uop_root : ns->tb_sym_root, name);
- if (st)
- {
- tb = st->n.tb;
- gcc_assert (tb);
- }
- else
- tb = NULL;
-
+ tb = st ? st->n.tb : NULL;
break;
}
case INTERFACE_USER_OP:
{
const bool is_op = (op_type == INTERFACE_USER_OP);
- gfc_symtree* st;
-
- st = gfc_new_symtree (is_op ? &ns->tb_uop_root : &ns->tb_sym_root,
- name);
+ gfc_symtree* st = gfc_get_tbp_symtree (is_op ? &ns->tb_uop_root :
+ &ns->tb_sym_root, name);
gcc_assert (st);
st->n.tb = tb;
+2016-11-12 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/77501
+ * gfortran.dg/typebound_generic_16.f90: New test.
+
2016-11-12 Jakub Jelinek <jakub@redhat.com>
PR c++/71225
--- /dev/null
+! { dg-do compile }
+!
+! PR 77501: [F03] ICE in gfc_match_generic, at fortran/decl.c:9429
+!
+! Contributed by Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de>
+
+module m1
+ type t
+ contains
+ generic :: f => g ! { dg-error "must target a specific binding" }
+ generic :: g => h ! { dg-error "Undefined specific binding" }
+ end type
+end
+
+module m2
+ type t
+ contains
+ generic :: f => g ! { dg-error "must target a specific binding" }
+ generic :: g => f ! { dg-error "Undefined specific binding" }
+ end type
+end