Commit 076ec830 by Tobias Burnus Committed by Tobias Burnus

re PR fortran/51913 ([OOP] bug when submitting a class pointer to a subroutine)

2012-01-21  Tobias Burnus  <burnus@net-b.de>

        PR fortran/51913
        * interface.c (compare_parameter): Fix CLASS comparison.

2012-01-21  Tobias Burnus  <burnus@net-b.de>

        PR fortran/51913
        * gfortran.dg/class_47.f90: New.

From-SVN: r183368
parent 7eeb2aa7
2012-01-21 Tobias Burnus <burnus@net-b.de>
PR fortran/51913
* interface.c (compare_parameter): Fix CLASS comparison.
2012-01-20 Tobias Burnus <burnus@net-b.de> 2012-01-20 Tobias Burnus <burnus@net-b.de>
Janus Weil <janus@gcc.gnu.org> Janus Weil <janus@gcc.gnu.org>
......
...@@ -1706,7 +1706,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, ...@@ -1706,7 +1706,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
return 0; return 0;
} }
/* F2003, 12.5.2.5. */ /* F2008, 12.5.2.5. */
if (formal->ts.type == BT_CLASS if (formal->ts.type == BT_CLASS
&& (CLASS_DATA (formal)->attr.class_pointer && (CLASS_DATA (formal)->attr.class_pointer
|| CLASS_DATA (formal)->attr.allocatable)) || CLASS_DATA (formal)->attr.allocatable))
...@@ -1718,8 +1718,8 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, ...@@ -1718,8 +1718,8 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
formal->name, &actual->where); formal->name, &actual->where);
return 0; return 0;
} }
if (CLASS_DATA (actual)->ts.u.derived if (!gfc_compare_derived_types (CLASS_DATA (actual)->ts.u.derived,
!= CLASS_DATA (formal)->ts.u.derived) CLASS_DATA (formal)->ts.u.derived))
{ {
if (where) if (where)
gfc_error ("Actual argument to '%s' at %L must have the same " gfc_error ("Actual argument to '%s' at %L must have the same "
......
2012-01-21 Tobias Burnus <burnus@net-b.de>
PR fortran/51913
* gfortran.dg/class_47.f90: New.
2012-01-21 Eric Botcazou <ebotcazou@adacore.com> 2012-01-21 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/renaming5.ad[sb]: New test. * gnat.dg/renaming5.ad[sb]: New test.
......
! { dg-do compile }
!
! PR fortran/51913
!
! Contributed by Alexander Tismer
!
MODULE m_sparseMatrix
implicit none
type :: sparseMatrix_t
end type sparseMatrix_t
END MODULE m_sparseMatrix
!===============================================================================
module m_subroutine
! USE m_sparseMatrix !< when uncommenting this line program works fine
implicit none
contains
subroutine test(matrix)
use m_sparseMatrix
class(sparseMatrix_t), pointer :: matrix
end subroutine
end module
!===============================================================================
PROGRAM main
use m_subroutine
USE m_sparseMatrix
implicit none
CLASS(sparseMatrix_t), pointer :: sparseMatrix
call test(sparseMatrix)
END PROGRAM
! { dg-final { cleanup-modules "m_sparsematrix m_subroutine" } }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment