Regression tested on x86_64-*-freebsd.  OK to commit?

2016-11-23  Steven G. Kargl  <ka...@gcc.gnu.org>

        PR fortran/78500
        * expr.c (gfc_check_vardef_contextm): YANPD
        * interface.c (matching_typebound_op): Ditto.

2016-11-23  Steven G. Kargl  <ka...@gcc.gnu.org>

        PR fortran/78500
        * gfortran.dg/pr78500.f90: New test.


Index: gcc/fortran/expr.c
===================================================================
--- gcc/fortran/expr.c  (revision 242789)
+++ gcc/fortran/expr.c  (working copy)
@@ -5291,7 +5291,8 @@ gfc_check_vardef_context (gfc_expr* e, b
      component.  Note that (normal) assignment to procedure pointers is not
      possible.  */
   check_intentin = !own_scope;
-  ptr_component = (sym->ts.type == BT_CLASS && CLASS_DATA (sym))
+  ptr_component = (sym->ts.type == BT_CLASS && sym->ts.u.derived
+                  && CLASS_DATA (sym))
                  ? CLASS_DATA (sym)->attr.class_pointer : sym->attr.pointer;
   for (ref = e->ref; ref && check_intentin; ref = ref->next)
     {
Index: gcc/fortran/interface.c
===================================================================
--- gcc/fortran/interface.c     (revision 242789)
+++ gcc/fortran/interface.c     (working copy)
@@ -3885,7 +3885,7 @@ matching_typebound_op (gfc_expr** tb_bas
 
        if (base->expr->ts.type == BT_CLASS)
          {
-           if (CLASS_DATA (base->expr) == NULL
+           if (!base->expr->ts.u.derived || CLASS_DATA (base->expr) == NULL
                || !gfc_expr_attr (base->expr).class_ok)
              continue;
            derived = CLASS_DATA (base->expr)->ts.u.derived;
Index: gcc/testsuite/gfortran.dg/pr78500.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr78500.f90       (nonexistent)
+++ gcc/testsuite/gfortran.dg/pr78500.f90       (working copy)
@@ -0,0 +1,5 @@
+! { dg-do compile }
+class(t) function f() ! { dg-error "must be dummy, allocatable or pointer" }
+   f = 1              ! { dg-error "variable must not be polymorphic" }
+end
+

-- 
Steve

Reply via email to