https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69554

--- Comment #12 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Thomas Koenig from comment #11)
> (In reply to Manuel López-Ibáñez from comment #7)
> > Please take this as a humble general suggestion: Fortran maintainers should
> > enforce during patch review that any new diagnostic has a corresponding
> > testcase triggering it in the testsuite.
> 
> I think you are right, on general principles.  We usually try this.
> You can get a lot of test cases testing for runtime errors, because
> you can only test for a single error with each test case...

I don't know much about Fortran, but in C/C++, the parser tries to continue
after an error, even if it has to skip whole functions. Thus, putting errors
into different dummy functions allows testing many errors per file.

> However, this would not have helped in this case.  The problem here
> was that the testsuite is lenient enough to allow for random
> junk to appear between two error messages (which is understandable,
> given that we only want to check for the particular error messages,
> and there is a lot of stuff in between), that nobody thought of this
> particular case (it only came to light when I wanted to test a new
> error message with two locations).

The code here should collapse those multi-line errors into:

https://sourceware.org/svn/gcc/trunk/gcc/testsuite/lib/gfortran-dg.exp

    #  [name]:[line]: Error: Some error at (1) and (2)
    #  [name]:[line2]: Error: Some error at (1) and (2)

Unless there are two location lines, the test will (should, otherwise there is
a bug) fail. In my testsuite log of r230753, there is not a single test for
this error. Such a testcase would have detected this bug.

Reply via email to