[Bug other/69554] [6 Regression] Multi-location diagnostics writes too many lines

2016-02-12 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69554

David Malcolm  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #19 from David Malcolm  ---
Should be fixed as of r233386; marking this as resolved.

[Bug other/69554] [6 Regression] Multi-location diagnostics writes too many lines

2016-02-12 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69554

--- Comment #18 from David Malcolm  ---
Author: dmalcolm
Date: Fri Feb 12 19:18:03 2016
New Revision: 233386

URL: https://gcc.gnu.org/viewcvs?rev=233386&root=gcc&view=rev
Log:
PR other/69554: avoid excessive source printing for widely-separated locations

gcc/ChangeLog:
PR other/69554
* diagnostic-show-locus.c (struct line_span): New struct.
(layout::get_first_line): Delete.
(layout::get_last_line): Delete.
(layout::get_num_line_spans): New member function.
(layout::get_line_span): Likewise.
(layout::print_heading_for_line_span_index_p): Likewise.
(layout::get_expanded_location): Likewise.
(layout::calculate_line_spans): Likewise.
(layout::m_first_line): Delete.
(layout::m_last_line): Delete.
(layout::m_line_spans): New field.
(layout::layout): Update comment.  Replace m_first_line and
m_last_line with m_line_spans, replacing their initialization
with a call to calculate_line_spans.
(diagnostic_show_locus): When printing source lines and
annotations, rather than looping over a single span
of lines, instead loop over each line_span within
the layout, with an inner loop over the lines within them.
Call the context's start_span callback when changing line spans.
* diagnostic.c (diagnostic_initialize): Initialize start_span.
(diagnostic_build_prefix): Break out the building of the location
part of the string into...
(diagnostic_get_location_text): ...this new function, rewriting
it from nested ternary expressions to a sequence of "if"
statements.
(default_diagnostic_start_span_fn): New function.
* diagnostic.h (diagnostic_start_span_fn): New typedef.
(diagnostic_context::start_span): New field.
(default_diagnostic_start_span_fn): New prototype.

gcc/fortran/ChangeLog:
PR other/69554
* error.c (gfc_diagnostic_start_span): New function.
(gfc_diagnostics_init): Initialize global_dc's start_span.

gcc/testsuite/ChangeLog:
PR other/69554
* gcc.dg/pr69554-1.c: New test.
* gfortran.dg/pr69554-1.F90: New test.
* gfortran.dg/pr69554-2.F90: New test.
* lib/gcc-dg.exp (proc dg-locus): New function.
* lib/gfortran-dg.exp (proc gfortran-dg-test): Update comment to
distinguish between the caret-printing and non-caret-printing
cases.  If caret-printing has been explicitly enabled, bail out
without attempting to fix up the output.


Added:
trunk/gcc/testsuite/gcc.dg/pr69554-1.c
trunk/gcc/testsuite/gfortran.dg/pr69554-1.F90
trunk/gcc/testsuite/gfortran.dg/pr69554-2.F90
Modified:
trunk/gcc/ChangeLog
trunk/gcc/diagnostic-show-locus.c
trunk/gcc/diagnostic.c
trunk/gcc/diagnostic.h
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/error.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/lib/gcc-dg.exp
trunk/gcc/testsuite/lib/gfortran-dg.exp

[Bug other/69554] [6 Regression] Multi-location diagnostics writes too many lines

2016-02-09 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69554

--- Comment #17 from David Malcolm  ---
Candidate patch posted here:
  https://gcc.gnu.org/ml/gcc-patches/2016-02/msg00646.html

[Bug other/69554] [6 Regression] Multi-location diagnostics writes too many lines

2016-02-07 Thread manu at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69554

--- Comment #16 from Manuel López-Ibáñez  ---
You can also just match the locations and the columns with dg-error. Placing
dg-error at the expected lines will match the expected output as explained in
comment 12. Fixing dg-begin-multiline-output for fortran might be too much
work/disruptive for gcc 6 stage 4.

[Bug other/69554] [6 Regression] Multi-location diagnostics writes too many lines

2016-02-05 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69554

--- Comment #15 from Thomas Koenig  ---
(In reply to David Malcolm from comment #14)
> Is there any way to do multiline comments in gfortran?
> 
> Am attempting to write expected output like this:
> 
> ! { dg-begin-multiline-output "" }
> EXPECTED OUTPUT TO GO HERE
> ! { dg-end-multiline-output "" }
> 
> If not, I may need to require every line within the begin/end to start with a
>   "! "
> and to strip that.

It is not possible to continue comments in Fortran.

You could place a block of code inside an #if 0 and invoke the
C preprocessor (preferably by using a file suffix like .F90)
to do something like

ig25@linux-fd1f:/tmp> cat comment.F90 
program main
#if 0
{ dg-begin-multiline-output "" }
EXPECTED OUTPUT TO GO HERE
{ dg-end-multiline-output "" }
#endif
end program main

which would a bit of a hack.

[Bug other/69554] [6 Regression] Multi-location diagnostics writes too many lines

2016-02-05 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69554

--- Comment #14 from David Malcolm  ---
Is there any way to do multiline comments in gfortran?

Am attempting to write expected output like this:

! { dg-begin-multiline-output "" }
EXPECTED OUTPUT TO GO HERE
! { dg-end-multiline-output "" }

If not, I may need to require every line within the begin/end to start with a
  "! "
and to strip that.

[Bug other/69554] [6 Regression] Multi-location diagnostics writes too many lines

2016-02-05 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69554

David Malcolm  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |dmalcolm at gcc dot 
gnu.org

[Bug other/69554] [6 Regression] Multi-location diagnostics writes too many lines

2016-02-01 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69554

David Malcolm  changed:

   What|Removed |Added

  Component|fortran |other

--- Comment #13 from David Malcolm  ---
I see this as a bug with the diagnostics subsystem, rather than Fortran per se;
setting component to "other"; I hope to have a look at this on Wednesday.

[Bug other/69554] [6 Regression] Multi-location diagnostics writes too many lines

2016-01-30 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69554

Dominique d'Humieres  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-01-30
 Ever confirmed|0   |1

--- Comment #6 from Dominique d'Humieres  ---
The change occurred between revision r229826 (2015-11-05) and r229946
(2015-11-08).

[Bug other/69554] [6 Regression] Multi-location diagnostics writes too many lines

2016-01-30 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69554

Thomas Koenig  changed:

   What|Removed |Added

   Target Milestone|--- |6.0
Summary|Multi-location diagnostics  |[6 Regression]
   |writes too many lines   |Multi-location diagnostics
   ||writes too many lines

--- Comment #5 from Thomas Koenig  ---
No patch is needed to expose this bug.

Test case:
ig25@linux-fd1f:/tmp> cat label.f90 
program main
  goto 1000
1000 continue
  a = a
  a = a
  a = a
1000 continue
end
ig25@linux-fd1f:/tmp> gfortran label.f90 
label.f90:3:4:

 1000 continue
1
   a = a

   a = a

   a = a

 1000 continue
2
Error: Duplicate statement label 1000 at (1) and (2)
ig25@linux-fd1f:/tmp> /usr/bin/gfortran label.f90 
label.f90:3.4:

1000 continue
1
label.f90:7.4:

1000 continue
2
Error: Duplicate statement label 1000 at (1) and (2)