[MPI3 Fortran] Results of recent J3 Fortran meeting

Malcolm Cohen malcolm at nag-j.co.jp
Wed Oct 20 19:04:35 CDT 2010

Hi Craig,

> The short answer is that a revised version of the paper passed (see 
> attachments).  The longer answer is that there was disagreements on how 
> assumed size characters should be implemented.  I've also attached a file with 
> two C functions showing the two choices.  Hopefully these example are mostly 
> correct, I haven't had a chance to test them yet.

Nitpick: that's "assumed length", "assumed size" is about arrays.  I know this 
terminology is confusing, with assumed size, shape, length, rank, type ... but 
since the paper does both assumed length (for characters), and also does passing 
assumed-size arrays to assumed-rank dummies, we need to get the terms right to 
avoid even more confusion!

Anyway, there are three choices described in 10-237r2 (one with edits and two 
without), and the one you dropped was my favourite one... viz the one that 
doesn't mix together the size of a character with the length of a string - this 
matters when you have multibyte characters; that's probably unimportant to MPI, 
but it is certainly important to other audiences.

If "choice 1" isn't taken, there is certainly more work required by J3 to sort 
out the technical details of choice 2 or choice 3.  Unfortunately we ran out of 
time to produce edits for all three versions for comparison.

Here is fstr_len modified to include all three choices.

int fstr_len(CFI_cdesc_t * desc)
    int err = -1;  /* this error code represents all errors */

    /* only support character type */
    if (desc->type != CFI_type_char) return err;

#ifdef CHOICE_1
    /* only support strings with Fortran rank 0 */
    if (desc->rank != 1) return err;

    /* character length stored in dim[0] */
    return desc->dim[0].extent;


    /* only support strings with Fortran rank 0 */
    if (desc->rank != 0) return err;

#ifdef CHOICE_2
    /* character length stored in elem_len */
    return desc->elem_len;
    /* character length stored in string_len */
    return desc->string_len;


................................Malcolm Cohen, Nihon NAG, Tokyo.

More information about the mpiwg-fortran mailing list