This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: [RFC PATCH fortran/diagnostics] Move gfc_error (buffered) to common diagnostics


Le 06/12/2014 14:38, Manuel López-Ibáñez a écrit :
> * Tobias or other Fortran maintainers. The only test failing is
> gfortran.dg/do_iterator.f90 line 7. The old code gives an Error there,
> which the new one does not.
> 
> /home/manuel/test1/pristine/gcc/testsuite/gfortran.dg/do_iterator.f90:7.9:
> 
>    READ(5,*) I ! { dg-error "cannot be redefined" "changing do-iterator 2" }
>          1
> Error: Invalid character in name at (1)
> 
> It seems that the gfc_error above is buffered first, then it is
> cleared, however, the old code does not actually clear the text only
> clears error_buffer.flag, then a gfc_error_now is emitted, which sets
> error_buffer.flag (?!), the next gfc_error_check then emits the text
> that was still in the buffer. Is this intended to work like this? If
> so, then this patch needs more work.
> 
I agree with Tobias: this error is certainly  bogus.
For what it's worth, I've had a set of unfinished diagnostic patches,
whose first one (attached) was taking care of this very error.

Mikael

commit 02000ad2b84f3f833bf26d74e055811266d348da
Author: Mik <mikael.morin@sfr.fr>
Date:   Thu Aug 15 12:39:05 2013 +0200

    io.c (match_io_element): appel a gfc_check_do_variable non fatal
diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c
index cc5ce12..196e4d5 100644
--- a/gcc/fortran/io.c
+++ b/gcc/fortran/io.c
@@ -3106,8 +3106,8 @@ match_io_element (io_kind k, gfc_code **cpp)
 		   io_kind_name (k));
     }
 
-  if (m == MATCH_YES && k == M_READ && gfc_check_do_variable (expr->symtree))
-    m = MATCH_ERROR;
+  if (m == MATCH_YES && k == M_READ)
+    gfc_check_do_variable (expr->symtree);
 
   if (m != MATCH_YES)
     {
diff --git a/gcc/testsuite/gfortran.dg/do_iterator.f90 b/gcc/testsuite/gfortran.dg/do_iterator.f90
index cb3e50d..e1fa18b 100644
--- a/gcc/testsuite/gfortran.dg/do_iterator.f90
+++ b/gcc/testsuite/gfortran.dg/do_iterator.f90
@@ -10,4 +10,3 @@ DO I=1,5       ! { dg-error "cannot be redefined" "changing do-iterator 3" }
    READ(5,*,iostat=i) j ! { dg-error "cannot be redefined" "changing do-iterator 3" }
 ENDDO
 END
-! { dg-error "Invalid character" "character" { target *-*-* } 7 }

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