This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Possible bug with assigning array return value from type-bound procedure?
- From: cls59 <chuck at sharpsteen dot net>
- To: fortran at gcc dot gnu dot org
- Date: Fri, 3 Jul 2009 17:02:08 -0700 (PDT)
- Subject: Possible bug with assigning array return value from type-bound procedure?
Hello all,
I've been exploring new Fortran 2003 features using gfortran 4.4 and a I
have come across an issue that seems like it may be a bug.
Basically, I have a type bound procedure that is a function which returns an
array. I can call the function as part of a write statement and I get output
that looks like an array. However, when I try to assign the output to an
array variable of the correct dimensions I get an internal compiler error.
I was about to submit a bug report to the GCC Bugzilla, but figured I would
check here since it is highly probable that the bug might lie on my side of
the keyboard.
A short test file that reproduces the problem for me is:
module bugTestMod
implicit none
type:: boundTest
contains
procedure, nopass:: test => returnMat
end type boundTest
contains
function returnMat( a, b ) result( mat )
integer:: a, b
double precision, dimension(a,b):: mat
mat = 1d0
return
end function returnMat
end module bugTestMod
program bugTest
use bugTestMod
implicit none
double precision, dimension(2,2):: testCatch
type( boundTest ):: testObj
write(*,*)testObj%test(2,2)
! Comment out this assignment and the code compiles
! and runs cleanly.
testCatch = testObj%test(2,2)
stop
end program bugTest
Any comments or insights are much appreciated!
-Charlie
-----
Charlie Sharpsteen
Undergraduate
Environmental Resources Engineering
Humboldt State University
--
View this message in context: http://www.nabble.com/Possible-bug-with-assigning-array-return-value-from-type-bound-procedure--tp24330102p24330102.html
Sent from the gcc - fortran mailing list archive at Nabble.com.