]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/54778 ([OOP] an ICE on invalid OO code)
authorJanus Weil <janus@gcc.gnu.org>
Tue, 2 Oct 2012 21:02:16 +0000 (23:02 +0200)
committerJanus Weil <janus@gcc.gnu.org>
Tue, 2 Oct 2012 21:02:16 +0000 (23:02 +0200)
2012-10-02  Janus Weil  <janus@gcc.gnu.org>

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.

From-SVN: r192005

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

index e1cb45affb1ed9fb6b6fcc10e30905ad4381950c..b6d44cd0d202fe84c6fc410959a6824c9c24669a 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 88689aa47d611896ecc519a51cd2018a321efcdc..6bcd607adc362666dbd880a7f8e944e948ee8a6f 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 1d2cac58a8c74b7f18f5f0dc480e20f00316ca94..2120cb4d965dc2d517ddceb1811f25383914e7d5 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