This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/45420] [OOP] polymorphic TBP call in a CLASS DEFAULT clause
- From: "sfilippone at uniroma2 dot it" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Aug 2010 07:37:15 -0000
- Subject: [Bug fortran/45420] [OOP] polymorphic TBP call in a CLASS DEFAULT clause
- References: <bug-45420-16146@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from sfilippone at uniroma2 dot it 2010-08-27 07:37 -------
(In reply to comment #2)
> It turns out this bug is rather easy to fix. The problem was the we used the
> temporary needed for the TYPE IS clause also in the CLASS DEFAULT clause (where
> we need none). The following patch fixes it (haven't checked for regressions
> yet):
>
Hi,
First, the patch did not apply cleanly, the first hunk was rejected. I applied
it by hand, and I got a problem down the road in my library:
===============================================================
gfortran -ggdb -I.. -I../modules -I. -c psb_srwextd.f90
psb_srwextd.f90:76.13:
call aa%mv_to_coo(actmp,info)
1
Error: Actual argument at (1) must be definable as the dummy argument 'a' is
INTENT = OUT/INOUT
psb_srwextd.f90:84.39:
if (info == psb_success_) call aa%mv_from_coo(actmp,info)
1
Error: Actual argument at (1) must be definable as the dummy argument 'a' is
INTENT = OUT/INOUT
============================================================================
The relevant piece of code is as follows:
============================================================================
subroutine psb_srwextd(nr,a,info,b,rowscale)
use psb_sparse_mod, psb_protect_name => psb_srwextd
implicit none
! Extend matrix A up to NR rows with empty ones (i.e.: all zeroes)
integer, intent(in) :: nr
type(psb_s_sparse_mat), intent(inout) :: a
integer,intent(out) :: info
type(psb_s_sparse_mat), intent(in), optional :: b
logical,intent(in), optional :: rowscale
integer :: i,j,ja,jb,err_act,nza,nzb
character(len=20) :: name, ch_err
type(psb_s_coo_sparse_mat) :: actmp
logical rowscale_
name='psb_srwextd'
info = psb_success_
call psb_erractionsave(err_act)
if (nr > a%get_nrows()) then
select type(aa=> a%a)
type is (psb_s_csr_sparse_mat)
if (present(b)) then
call psb_rwextd(nr,aa,info,b%a,rowscale)
else
call psb_rwextd(nr,aa,info,rowscale=rowscale)
end if
type is (psb_s_coo_sparse_mat)
if (present(b)) then
call psb_rwextd(nr,aa,info,b%a,rowscale=rowscale)
else
call psb_rwextd(nr,aa,info,rowscale=rowscale)
end if
class default
call aa%mv_to_coo(actmp,info)
if (info == psb_success_) then
if (present(b)) then
call psb_rwextd(nr,actmp,info,b%a,rowscale=rowscale)
else
call psb_rwextd(nr,actmp,info,rowscale=rowscale)
end if
end if
if (info == psb_success_) call aa%mv_from_coo(actmp,info)
end select
end if
if (info /= psb_success_) goto 9999
call psb_erractionrestore(err_act)
return
9999 continue
call psb_erractionrestore(err_act)
if (err_act == psb_act_abort_) then
call psb_error()
return
end if
return
end subroutine psb_srwextd
==================================================================
The calls to AA%MV_TO ad AA%MV_FROM should be able to modify AA, since
1. AA => A%A
2. A is an INOUT dummy argument.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45420