http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50554
kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kargl at gcc dot gnu.org --- Comment #2 from kargl at gcc dot gnu.org 2011-10-16 22:35:10 UTC --- (In reply to comment #1) > Confirmed. We need to add a gfc_check_do_variable in io.c's gfc_match_inquire. This patch Index: io.c =================================================================== --- io.c (revision 180062) +++ io.c (working copy) @@ -3921,6 +3921,9 @@ gfc_match_inquire (void) if (gfc_match_char (')') != MATCH_YES) goto syntax; + if (gfc_check_do_variable (inquire->iolength->symtree)) + goto cleanup; + m = match_io_list (M_INQUIRE, &code); if (m == MATCH_ERROR) goto cleanup; generates laptop:kargl[213] gfc4x -c -Wall foo.f90 foo.f90:2.26: inquire(iolength=I) n 1 foo.f90:1.15: do I=1,10 2 Error: Variable 'i' at (1) cannot be redefined inside loop beginning at (2) foo.f90:2.23: inquire(iolength=I) n 1 Error: Unexpected junk in formal argument list at (1)