re PR fortran/16404 (should reject invalid code with -pedantic -std=f95 ? (x8))
authorTobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
Fri, 16 Jul 2004 00:57:43 +0000 (02:57 +0200)
committerTobias Schlüter <tobi@gcc.gnu.org>
Fri, 16 Jul 2004 00:57:43 +0000 (02:57 +0200)
fortran/
* parse.c (gfc_check_do_variable): Fix error locus.

testsuite/
PR fortran/16404
* gfortran.dg/do_iterator.f90: New test.

From-SVN: r84795

gcc/fortran/ChangeLog
gcc/fortran/parse.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/do_iterator.f90 [new file with mode: 0644]

index d3f24d068b039ca4dae49ff940000da2651e9ebb..925b45c45d4a29f01bf6b8fd93428db9dd156e7b 100644 (file)
@@ -20,6 +20,8 @@
        (match_io): Reformat error message.
        (match_inquire_element): Call match_out_tag where appropriate.
 
+       * parse.c (gfc_check_do_variable): Fix error locus.
+
 2004-07-15  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>
 
        PR fortran/15129
index 68f1ddd673db0ee368c34c98ae90082cd80b18e1..765fd06c5bf8fba2944e604dce9dcccc8b7b6e0b 100644 (file)
@@ -1926,7 +1926,7 @@ gfc_check_do_variable (gfc_symtree *st)
     if (s->do_variable == st)
       {
        gfc_error_now("Variable '%s' at %C cannot be redefined inside "
-                     "loop beginning at %L", st->name, &s->tail->loc);
+                     "loop beginning at %L", st->name, &s->head->loc);
        return 1;
       }
 
index 5269f5d6e84e42a932eb1c876d2a1ed063b76cba..83f28398a7a0bd6a3064bbe5f6a9ca0124784c84 100644 (file)
@@ -5,6 +5,9 @@
        * lib/gfortran-dg.exp (gfortran-dg-runtest): Only test with all
        of TORTURE_OPTIONS if test contains 'dg-do run'.
 
+       PR fortran/16404
+       * gfortran.dg/do_iterator.f90: New test.
+
 2004-07-16  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
        PR rtl-optimization/16536
diff --git a/gcc/testsuite/gfortran.dg/do_iterator.f90 b/gcc/testsuite/gfortran.dg/do_iterator.f90
new file mode 100644 (file)
index 0000000..982568e
--- /dev/null
@@ -0,0 +1,9 @@
+! { dg-do compile }
+! various checks which verify that we don't change do-iterators
+DO I=1,5
+   I=1        ! { dg-error "cannot be redefined" "changing do-iterator 1" }
+   READ(5,*) I ! { dg-error "cannot be redefined" "changing do-iterator 2" }
+   READ(5,*,iostat=i) j ! { dg-error "cannot be redefined" "changing do-iterator 3" }
+ENDDO
+END
+