http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54778
janus at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Keywords| |ice-on-invalid-code Last reconfirmed| |2012-10-02 CC| |janus at gcc dot gnu.org AssignedTo|unassigned at gcc dot |janus at gcc dot gnu.org |gnu.org | Ever Confirmed|0 |1 Summary|an ICE on invalid OO code |[OOP] an ICE on invalid OO | |code --- Comment #1 from janus at gcc dot gnu.org 2012-10-02 16:12:50 UTC --- Thanks for reporting. I can reproduce this on 4.7 and trunk. Here is a patch to fix it: Index: gcc/fortran/interface.c =================================================================== --- gcc/fortran/interface.c (revision 191869) +++ gcc/fortran/interface.c (working copy) @@ -3386,7 +3386,8 @@ matching_typebound_op (gfc_expr** tb_base, if (base->expr->ts.type == BT_CLASS) { - if (CLASS_DATA (base->expr) == NULL) + if (CLASS_DATA (base->expr) == NULL + || !gfc_expr_attr (base->expr).class_ok) continue; derived = CLASS_DATA (base->expr)->ts.u.derived; } With this I get: c0.f90:14.2: function elem(this, i) 1 Error: CLASS variable 'elem' at (1) must be dummy, allocatable or pointer c0.f90:18.4: elem = this%elements(i) 1 Error: Variable must not be polymorphic in intrinsic assignment at (1) - check that there is a matching specific subroutine for '=' operator Regtesting now ...