ICE on deferred-length character allocatable array function

Rouson, Damian rouson@sandia.gov
Mon Jul 23 07:03:00 GMT 2012


A 15 July 2012 build of the gfortran development branch gives an ICE on a
function that returns an allocatable array of deferred-length character
variables.  See below.  The code compiles when the result "dimension(:)"
is removed from the declaration of "return_string".

The case that most interests me is one wherein the "argument" variable is
also an array declared as

   character(*), dimension(:), intent(in) :: argument

but these extra details are unnecessary to produce the ICE.

Damian




$ cat deferred_length_char_array.f90
module deferred_length_char_array
contains
  function return_string(argument)
    character(*) :: argument
    character(:), dimension(:), allocatable :: return_string
    return_string = argument
  end function 
end module

$ gfortran -c deferred_length_char_array.f90
deferred_length_char_array.f90: In function 'return_string':
deferred_length_char_array.f90:6:0: internal compiler error: in
gimplify_var_or_parm_decl, at gimplify.c:2048
     return_string = argument
 ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://trac.macports.org/newticket> for instructions.

$ gfortran --version
GNU Fortran (MacPorts gcc48 4.8-20120715_0) 4.8.0 20120715 (experimental)
Copyright (C) 2012 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




More information about the Fortran mailing list