Dear Tobias,

OK for trunk - just a wee typo to correct:
s/+     parameter available to the caller; gfortran save it in the
.mod files. */
/+     parameter available to the caller; gfortran saves it in the
.mod files. *//

Thanks for the patch.

Paul

On 13 May 2012 15:50, Tobias Burnus <bur...@net-b.de> wrote:
> Tobias Burnus wrote:
>>
>> Note that the patch assumes that the function's result variable's length
>> specification expression is completely known to the caller. I think that's
>> always the case in gfortran - or is it not?
>
>
> Thinking about it, I came to the conclusion has explicitly been designed
> such that it is known.
>
> Note: The attached patch is required in addition to make sure that the
> variable has the correct name mangling and to ensure that the string length
> is TREE_PUBLIC() = 1, when needed.
>
> The trans-expr.c part of the patch has been posted at
> http://gcc.gnu.org/ml/fortran/2012-05/msg00054.html
>
>
> Compile ("-c") the following code - with the function commented or not and
> with PUBLIC and PRIVATE - and look resulting .o file via nm. It shouldn't
> show the "str" variable (and the length variable) if (and only) if it is
> private and not used in the function result expression. Result for the
> program as shown below:
>
> 0000000000000008 B .__m_MOD_str
> 0000000000000000 T __m_MOD_bar
> 0000000000000000 B __m_MOD_str
>
>
> module m
> !  character(len=:), PRIVATE, allocatable :: str
>  character(len=:), PUBLIC, allocatable :: str
> contains
>  ! Note due to technical reasons (TBP, generic, cf. resolve.c),
>  ! a "PRIVATE :: bar" still counts a publicly using "str".
>  function bar()
>    character(len=len(str)) :: str
>  end function bar
> end module m
>
> Tobias



-- 
The knack of flying is learning how to throw yourself at the ground and miss.
       --Hitchhikers Guide to the Galaxy

Reply via email to