http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46588

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
                 CC|                            |burnus at gcc dot gnu.org
            Summary|Segfault on automatic       |ICE with assumed character
                   |function                    |length function

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2010-11-22 
08:09:07 UTC ---
(In reply to comment #2)
> Reduced testcase.
> 
> function aufun(pm)
> character(len = *) pm
> character(len = *) aufun
> character(len = len(aufun)) temp ! This is the problem.
> aufun = 'hi'
> end

Looks like legal Fortran of the ugly kind:
  character(len = *) pm
takes the length of the argument.

  character(len = *) aufun
takes the length of the definition; that's called "assumed character length
function", is obsolescence; cf. F2008 B.2.6. It runs against the spirit of
(modern) Fortran. Usage:
  function f()
    character(len=*) :: f
  end function
  subroutine test
    character(len=7) :: f
    print *, len(f())
  end
  subroutine test2
    character(len=1) :: f
    print *, len(f())
  end

  character(len = len(aufun)) temp
Also that line looks to be OK if the other lines are valid.

Reply via email to