https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71412

--- Comment #2 from relliott at umn dot edu ---
> I believe gfortran's behavior conforms to the standard.  F2003 states
>
>   When the execution of a procedure is terminated by execution
>   of a RETURN or END statement, an allocatable variable that is
>   a named local variable of the procedure retains its allocation
>   and definition status if it has the SAVE attribute or is a
>   function result variable or a subobject thereof; otherwise, it
>   is deallocated.
>
> val is a local variable.  val does not have the SAVE attribute.

If that is the case, how should the desired result be achieved in a standard 
conformant way?

Reply via email to