This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
ICE on deferred-length, allocatable character variable function result
- From: "Rouson, Damian" <rouson at sandia dot gov>
- To: "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>
- Date: Tue, 9 Aug 2011 02:17:45 +0000
- Subject: ICE on deferred-length, allocatable character variable function result
Comment 9 on Bug (45170
<http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45170) states that gfortran
does not yet support "function result variables which are
character(len=:), pointer". Presumably this also implies a lack ofsupport
for replacing these with allocatable, deferred-length character variables.
I'm adding the case below because it produces an ICE with gfortran 4.6.1.
This is a reduced case. In my intended application, the "speaker" type
is abstract with deferred "speak" procedure that implements an abstract
interface matching the actual "speak" procedure below:
$ cat speaker.F90
module speaker_class
type speaker
contains
procedure :: speak
end type
contains
function speak(this)
class(speaker) ,intent(in) :: this
character(:) ,allocatable :: speak
end function
subroutine say_something(somebody)
class(speaker) :: somebody
print *,somebody%speak()
end subroutine
end module
$ gfortran -c speaker.F90
speaker.F90: In function 'say_something':
speaker.F90:13:0: internal compiler error: in fold_convert_loc, at
fold-const.c:1906
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ gfortran --version
GNU Fortran (GCC) 4.6.1 20110325 (prerelease)
Copyright (C) 2011 Free Software Foundation, Inc.
GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING