[Bug fortran/54070] Wrong code with allocatable deferred-length (array) function results

burnus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jul 23 10:23:00 GMT 2012


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-07-23 10:23:15 UTC ---
(In reply to comment #0)
> function f()
>   character(len=:),allocatable :: f
>   f ="ABC"
> end function

Here, one has for the internal length assignment:
  .__result = 3

The RHS is a simple "3", but the LHS is a pointer to an integer ...

 * * *

(In reply to comment #0)
> One gets the same ICE for the original example. Looking at the dump, there is
> no (re)allocation - but there should be one!

Pilot error of mine: As that code also lacks an ALLOCATE, it is also invalid
without an explicit ALLOCATE statement.

(The real-world program uses an array on the RHS. When the result_string has no
"dimension(:)", it compiled. For both, cf. email.)



More information about the Gcc-bugs mailing list