OSDN Git Service

fortran/
authortobi <tobi@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 16 Jul 2004 00:57:43 +0000 (00:57 +0000)
committertobi <tobi@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 16 Jul 2004 00:57:43 +0000 (00:57 +0000)
* parse.c (gfc_check_do_variable): Fix error locus.

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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@84795 138bc75d-0d04-0410-961f-82ee72b054a4

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

index d3f24d0..925b45c 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 68f1ddd..765fd06 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 5269f5d..83f2839 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
+