From: Tobias Schlüter Date: Fri, 16 Jul 2004 00:57:43 +0000 (+0200) Subject: re PR fortran/16404 (should reject invalid code with -pedantic -std=f95 ? (x8)) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b38b6477f8229197137a63d2e9abd20fb0bb83d5;p=gcc.git re PR fortran/16404 (should reject invalid code with -pedantic -std=f95 ? (x8)) fortran/ * parse.c (gfc_check_do_variable): Fix error locus. testsuite/ PR fortran/16404 * gfortran.dg/do_iterator.f90: New test. From-SVN: r84795 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index d3f24d068b0..925b45c45d4 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -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 PR fortran/15129 diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c index 68f1ddd673d..765fd06c5bf 100644 --- a/gcc/fortran/parse.c +++ b/gcc/fortran/parse.c @@ -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; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5269f5d6e84..83f28398a7a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 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 index 00000000000..982568e3909 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/do_iterator.f90 @@ -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 +