]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
do_iterator: Split loop, markup all lines for which an error locus is printed.
authorTobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
Mon, 21 Feb 2005 13:03:06 +0000 (14:03 +0100)
committerTobias Schlüter <tobi@gcc.gnu.org>
Mon, 21 Feb 2005 13:03:06 +0000 (14:03 +0100)
* gfortran.dg/do_iterator: Split loop, markup all lines for
which an error locus is printed.
* gfortran.dg/pr17708.f90: Markup all lines for which an error
locus is printed.
* gfortran.dg/select_4.f90: Likewise.
* lib/gfortran-dg.exp (gfortran-dg-test): Handle gfortran error
locuses in the various permutations.

From-SVN: r95329

gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/do_iterator.f90
gcc/testsuite/gfortran.dg/pr17708.f90
gcc/testsuite/gfortran.dg/select_4.f90
gcc/testsuite/lib/gfortran-dg.exp

index 68594ec18b4f26fa474a4ebd6731290307c4e1ca..0feb30b148bc7359a52b298439f237d031ea1e6d 100644 (file)
@@ -1,3 +1,13 @@
+2005-02-20  Tobias Schl"uter  <tobias.schlueter@physik.uni-muenchen.de>
+
+       * gfortran.dg/do_iterator: Split loop, markup all lines for
+       which an error locus is printed.
+       * gfortran.dg/pr17708.f90: Markup all lines for which an error
+       locus is printed.
+       * gfortran.dg/select_4.f90: Likewise.
+       * lib/gfortran-dg.exp (gfortran-dg-test): Handle gfortran error
+       locuses in the various permutations.
+
 2005-02-20  Dorit Naishlos  <dorit@il.ibm.com>
 
        PR tree-optimization/19951
index 982568e3909bc98a9194bc65e73d18c765a81e5b..0e11aa23339a0b6eb436074eb64124ebd3fd296b 100644 (file)
@@ -1,8 +1,12 @@
 ! { 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" }
+DO I=1,5       ! { dg-error "cannot be redefined" "changing do-iterator 1" }
+   I=1         ! { dg-error "cannot be redefined" "changing do-iterator 1" }
+END DO
+DO I=1,5       ! { dg-error "cannot be redefined" "changing do-iterator 2" }
    READ(5,*) I ! { dg-error "cannot be redefined" "changing do-iterator 2" }
+END DO
+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
index 7485da8bb070a75dd0eaa96bcda1e060b4dc5cda..b696b0c27579c00f337c7b3ed34c945041e402b3 100644 (file)
@@ -2,8 +2,8 @@
       program test
         j = 0
         do 10 i=1,3
-           if(i == 2) goto 10 ! { dg-warning "" "" }
+           if(i == 2) goto 10 ! { dg-warning "jumps to END" }
            j = j+1
-10      enddo
+10      enddo                 ! { dg-warning "jumps to END" }
         if (j/=2) call abort
       end
index 8fb661f7c22c1680800bcffa6b99abf0b54919ff..dbced6e4c665a15bb4b94bcdc045be9a791651c7 100644 (file)
@@ -4,15 +4,15 @@
 program select_5
   integer i
   select case(i)
-  case (20:30)
-  case (25:) ! { dg-error "overlaps with CASE" "" }
+  case (20:30) ! { dg-error "overlaps with CASE" }
+  case (25:) ! { dg-error "overlaps with CASE" }
   end select
   select case(i)
-  case (30)
-  case (25:) ! { dg-error "overlaps with CASE" "" }
+  case (30)  ! { dg-error "overlaps with CASE" }
+  case (25:) ! { dg-error "overlaps with CASE" }
   end select
   select case(i)
-  case (20:30)
-  case (25) ! { dg-error "overlaps with CASE" "" }
+  case (20:30) ! { dg-error "overlaps with CASE" }
+  case (25) ! { dg-error "overlaps with CASE" }
   end select
 end program select_5
index 2387403030b1f0af5ba25d119adfc3ee5a3c7590..d6887b050e2970e5eb99cdf82775b16118059fe8 100644 (file)
@@ -1,4 +1,4 @@
-#   Copyright (C) 2004 Free Software Foundation, Inc.
+#   Copyright (C) 2004, 2005 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -25,11 +25,38 @@ proc gfortran-dg-test { prog do_what extra_tool_flags } {
     set comp_output [lindex $result 0]
     set output_file [lindex $result 1]
 
-    # Put the error message on the same line as the line number
-    # FIXME: Add a colon after line number
-    # Remove the line of source code with the error and
-    # the number pointing to error
-    regsub -all "\n\n\[^\n\]*\n *\[0-9\]*\n" $comp_output ": " comp_output    
+    # gfortran error messages look like this:
+    #      In file [name]:[line]
+    #
+    #        some code
+    #              1
+    #     Error: Some error at (1) and (2)
+    # or
+    #      In file [name]:[line]
+    #
+    #       some code
+    #              1
+    #      In file [name]:[line2]
+    #
+    #       some other code
+    #         2
+    #     Error: Some error at (1) and (2)
+    # or
+    #      In file [name]:[line]
+    #
+    #       some code and some more code
+    #              1       2
+    #     Error: Some error at (1) and (2)
+    #
+    # We collapse these to look like:
+    #  [name]:[line]: Error: Some error at (1) and (2)
+    # or
+    #  [name]:[line]: Error: Some error at (1) and (2)
+    #  [name]:[line2]: Error: Some error at (1) and (2)
+    # We proceed in two steps: first we deal with the form with two
+    # different locus lines, then with the form with only one locus line.
+    regsub -all " In file (\[^\n\]*)\n\n\[^\n\]*\n\[^\n\]*\n In file (\[^\n\]*)\n\n\[^\n\]*\n\[^\n\]*\n(\[^\n\]*)\n" $comp_output "\\1: \\3\n\\2: \\3\n"  comp_output
+    regsub -all " In file (\[^\n\]*)\n\n\[^\n\]*\n\[^\n\]*\n(\[^\n\]*)\n" $comp_output "\\1: \\2\n" comp_output
 
     return [list $comp_output $output_file]
 }