2012-10-02 Janus Weil <janus@gcc.gnu.org>
authorjanus <janus@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 Oct 2012 21:02:16 +0000 (21:02 +0000)
committerjanus <janus@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 Oct 2012 21:02:16 +0000 (21:02 +0000)
PR fortran/54778
* interface.c (matching_typebound_op): Check for 'class_ok' attribute.

2012-10-02  Janus Weil  <janus@gcc.gnu.org>

PR fortran/54778
* gfortran.dg/class_53.f90: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@192005 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/interface.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/class_53.f90 [new file with mode: 0644]

index e1cb45a..b6d44cd 100644 (file)
@@ -1,3 +1,8 @@
+2012-10-02  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/54778
+       * interface.c (matching_typebound_op): Check for 'class_ok' attribute.
+
 2012-09-30  Janus Weil  <janus@gcc.gnu.org>
 
        PR fortran/54667
index 88689aa..6bcd607 100644 (file)
@@ -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;
          }
index 1d2cac5..2120cb4 100644 (file)
@@ -1,3 +1,8 @@
+2012-10-02  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/54778
+       * gfortran.dg/class_53.f90: New.
+
 2012-10-02  Alexandre Oliva <aoliva@redhat.com>
 
        PR debug/54551
diff --git a/gcc/testsuite/gfortran.dg/class_53.f90 b/gcc/testsuite/gfortran.dg/class_53.f90
new file mode 100644 (file)
index 0000000..0a8c962
--- /dev/null
@@ -0,0 +1,18 @@
+! { dg-do compile }
+!
+! PR 54778: [OOP] an ICE on invalid OO code
+!
+! Contributed by Sylwester Arabas <slayoo@staszic.waw.pl>
+
+implicit none
+
+type :: arr_t
+  real :: at
+end type
+
+type(arr_t) :: this
+class(arr_t) :: elem   ! { dg-error "must be dummy, allocatable or pointer" }
+
+elem = this   ! { dg-error "Variable must not be polymorphic in intrinsic assignment" }
+
+end