[patch, fortran] Separate READ from WRITE

Tobias Burnus burnus@net-b.de
Tue Oct 12 13:32:00 GMT 2010


  On 10/11/2010 08:57 PM, Tobias Burnus wrote:
>  Thomas Koenig wrote:
>> Well, feedback seems to have been positive, so here is the formal patch
>> with a proper changelog entry.
>
> No review yet but:
>
>    iocall[IOCALL_X_LOGICAL] = gfc_build_library_function_decl_with_spec (
>      get_identifier (PREFIX("transfer_logical")), ".wW",
>      void_type_node, 3, dt_parm_type, pvoid_type_node, 
> gfc_int4_type_node);
>
> +  iocall[IOCALL_X_LOGICAL_WRITE] = 
> gfc_build_library_function_decl_with_spec (
> +    get_identifier (PREFIX("transfer_logical_write")), ".rW",
> +    void_type_node, 3, dt_parm_type, pvoid_type_node, 
> gfc_int4_type_node);
> +

I looked at libgfortran/io/transfer.c and both 
formatted_transfer_scalar_read and -_write contain a like like:
   dtp->u.p.sf_read_comma =
     dtp->u.p.current_unit->decimal_status == DECIMAL_COMMA ? 0 : 1;

Thus, I think the first argument should be "w" (i.e. the attribute 
should start with ".w"). However, I have still the feeling that READ and 
thus transfer_logical should have ".wW" (as it is now) while WRITE 
should have ".wR" (and not ".rW"). Recall in that the first item in the 
string (".") skips over the *return value* (which here is "void"). The 
last argument (int4 len) has no spec as it is passed by value and thus 
does not need a fn-spec. (One could use ".wW." or ".wWR" but the last 
character in the string would just waste CPU cycles (in the ME) and at 
least a byte ;-)

Tobias



More information about the Fortran mailing list