Patchwork [fortran] PR 50554 - redefinition of index variable with inquire(iolength=...)

login
register
mail settings
Submitter Tobias Burnus
Date June 27, 2013, 9:33 p.m.
Message ID <51CCAF9A.4060603@net-b.de>
Download mbox | patch
Permalink /patch/255229/
State New
Headers show

Comments

Tobias Burnus - June 27, 2013, 9:33 p.m.
Thomas Koenig wrote:
> the attached patch raises an error if an index variable is redefined
> with inquire(iolength=...).
>
>         * frontend-passes.c (doloop_code): Check do loop variables for
>         EXEC_IOLENGTH.

What's the advantage to place it into doloop_code rather than using - as 
Steve's patch in the PR - gfc_check_do_variable. Your version looks much 
more complicated, adding a special case for IOLENGTH. His version is 
already used, e.g., for match_out_tag in io.c - which is about nearly 
all intent(out) integer items in IO statements.

Actually, I wonder whether the following (untested) shouldn't be sufficient:



Tobias

Patch

--- a/gcc/fortran/io.c
+++ b/gcc/fortran/io.c
@@ -3892,3 +3892,3 @@  match_inquire_element (gfc_inquire *inquire)
    RETM m = match_vtag (&tag_s_decimal, &inquire->decimal);
-  RETM m = match_vtag (&tag_size, &inquire->size);
+  RETM m = match_out_tag (&tag_size, &inquire->size);
    RETM m = match_vtag (&tag_s_encoding, &inquire->encoding);
@@ -3897,3 +3897,3 @@  match_inquire_element (gfc_inquire *inquire)
    RETM m = match_vtag (&tag_s_pad, &inquire->pad);
-  RETM m = match_vtag (&tag_iolength, &inquire->iolength);
+  RETM m = match_out_tag (&tag_iolength, &inquire->iolength);
    RETM m = match_vtag (&tag_convert, &inquire->convert);