diff options
author | Janus Weil <janus@gcc.gnu.org> | 2014-01-04 10:25:04 +0100 |
---|---|---|
committer | Janus Weil <janus@gcc.gnu.org> | 2014-01-04 10:25:04 +0100 |
commit | e8ed37508957f989a10b0d66dc0910ced0b2716b (patch) | |
tree | 40ab8b60e673b55602d3d38333834de622aa7408 | |
parent | 953ff780436f23f937537ea51fce120a305c81de (diff) | |
download | gcc-e8ed37508957f989a10b0d66dc0910ced0b2716b.zip gcc-e8ed37508957f989a10b0d66dc0910ced0b2716b.tar.gz gcc-e8ed37508957f989a10b0d66dc0910ced0b2716b.tar.bz2 |
re PR fortran/59547 ([OOP] Problem with using tbp specification function in multiple class procedures)
2014-01-04 Janus Weil <janus@gcc.gnu.org>
PR fortran/59547
* class.c (add_proc_comp): Copy pure attribute.
2014-01-04 Janus Weil <janus@gcc.gnu.org>
PR fortran/59547
* gfortran.dg/typebound_proc_32.f90: New.
From-SVN: r206331
-rw-r--r-- | gcc/fortran/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/fortran/class.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/typebound_proc_32.f90 | 35 |
4 files changed, 48 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 202c047..40a26db 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2014-01-04 Janus Weil <janus@gcc.gnu.org> + + PR fortran/59547 + * class.c (add_proc_comp): Copy pure attribute. + 2014-01-02 Richard Sandiford <rdsandiford@googlemail.com> Update copyright years diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c index 47a3082..1b243f6 100644 --- a/gcc/fortran/class.c +++ b/gcc/fortran/class.c @@ -714,9 +714,11 @@ add_proc_comp (gfc_symbol *vtype, const char *name, gfc_typebound_proc *tb) if (tb->u.specific) { - c->ts.interface = tb->u.specific->n.sym; + gfc_symbol *ifc = tb->u.specific->n.sym; + c->ts.interface = ifc; if (!tb->deferred) c->initializer = gfc_get_variable_expr (tb->u.specific); + c->attr.pure = ifc->attr.pure; } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 517c724..8a9c0cb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-01-04 Janus Weil <janus@gcc.gnu.org> + + PR fortran/59547 + * gfortran.dg/typebound_proc_32.f90: New. + 2014-01-03 Marc Glisse <marc.glisse@inria.fr> PR c++/58950 diff --git a/gcc/testsuite/gfortran.dg/typebound_proc_32.f90 b/gcc/testsuite/gfortran.dg/typebound_proc_32.f90 new file mode 100644 index 0000000..00ae9c7 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/typebound_proc_32.f90 @@ -0,0 +1,35 @@ +! { dg-do compile } +! +! PR 59547: [OOP] Problem with using tbp specification function in multiple class procedures +! +! Contributed by <bugs@miller-mohr.de> + +module classes + + implicit none + + type :: base_class + contains + procedure, nopass :: get_num + procedure :: get_array, get_array2 + end type + +contains + + pure integer function get_num() + get_num = 2 + end function + + function get_array( this ) result(array) + class(base_class), intent(in) :: this + integer, dimension( this%get_num() ) :: array + end function + + function get_array2( this ) result(array) + class(base_class), intent(in) :: this + integer, dimension( this%get_num(), this%get_num() ) :: array + end function + +end module + +! { dg-final { cleanup-modules "classes" } } |