This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch, fortran] PR 50554 - redefinition of index variable with inquire(iolength=...)


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

Seems to work.

Build and regtested on x86-64-gnu-linux.
OK for the trunk?

Tobias
2013-06-28  Tobias Burnus  <burnus@net-b.de>

	PR fortran/50554
	* io.c (match_inquire_element): Add missing do-var check.

2013-06-28  Tobias Burnus  <burnus@net-b.de>

	PR fortran/50554
	* gfortran.dg/do_check_9.f90: New.

diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c
index c5120dd..678bc5d 100644
--- a/gcc/fortran/io.c
+++ b/gcc/fortran/io.c
@@ -3890,12 +3890,12 @@ match_inquire_element (gfc_inquire *inquire)
   RETM m = match_vtag (&tag_s_async, &inquire->asynchronous);
   RETM m = match_vtag (&tag_s_delim, &inquire->delim);
   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);
   RETM m = match_vtag (&tag_s_round, &inquire->round);
   RETM m = match_vtag (&tag_s_sign, &inquire->sign);
   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);
   RETM m = match_out_tag (&tag_strm_out, &inquire->strm_pos);
   RETM m = match_vtag (&tag_pending, &inquire->pending);
--- /dev/null	2013-06-28 09:04:44.785079259 +0200
+++ gcc/gcc/testsuite/gfortran.dg/do_check_9.f90	2013-06-28 09:57:03.224522219 +0200
@@ -0,0 +1,14 @@
+! { dg-do compile }
+!
+! PR fortran/50554
+!
+! Contributed by Vittorio Zecca
+!
+! INQUIRE cannot redefine DO index
+!
+      do I=1,10 ! { dg-error "cannot be redefined inside loop beginning at" }
+       inquire(iolength=I) n ! { dg-error "cannot be redefined inside loop beginning at" }
+       inquire(99,size=I) ! { dg-error "cannot be redefined inside loop beginning at" }
+       read(99,'(i4)',size=I,advance="no") n ! { dg-error "cannot be redefined inside loop beginning at" }
+      end do
+      end

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]