[Patch,Fortran] PR 43665 -- add fn-spec annotation based on INTENT settings

Mikael Morin mikael.morin@sfr.fr
Tue Sep 7 22:30:00 GMT 2010


Le 07.09.2010 20:58, Tobias Burnus a écrit :
>
> Tobias Burnus wrote:
>> The following patch requires Martin's patch (attached to the PR) or
>> the option -fno-ipa-cp.as otherwise the argument removal can cause
>> wrong code.
>
> Martin's patch is now in - and in principle this patch can get in. Thus,
> I would like if someone could review this patch. However, ...
>
>> I will regtest the patch after Martin's patch is in. Assuming no
>> failures:
>
> Actually there are failures: gfortran.dg/cray_pointers_2.f90 fails with
> -O3 and gfortran.dg/fgetc_2.f90 with -O1. I have only looked at the
> latter. It fails because in
>
> st = fgetc(10,s)
> if (s(1:1) /= "1") call abort
> st = fgetc(10,s)
> if (s(1:1) /= "2") call abort
>
> The second "call abort()" is executed unconditionally. That makes sense
> if one looks at intrinsics.c:
> add_sym_2 ("fputc", ...
> where add_sym_2 calls:
> add_sym (name, id, cl, actual_ok, type, kind, standard, cf, sf, rf,
> a1, type1, kind1, optional1, INTENT_IN,
> a2, type2, kind2, optional2, INTENT_IN,
> (void *) 0);
>
> Note the INTENT_IN! Thus, optimizing the 's(1:1) /= "2"' check away
> makes sense. However, that means that before this patch can get in, one
> needs to audit the intrinsics and update the intents.
>
> Therefore: I would be delighted if someone could review the trans-decl.c
> part of this patch; however, I plan to send an updated patch with
> unchanged/review fixed trans-decl.c and intrinsic.c fixes.
>
> Tobias
>
Hello,

the trans-decl.c part is OK.
I'm just wondering why you don't call gfc_create_fn_spec from 
gfc_get_function_type directly. Are there cases where you don't want the 
fn spec ?

Mikael



More information about the Fortran mailing list