Hi Mikael,

Am 19.07.22 um 22:53 schrieb Mikael Morin:
It could be anything better than the (unhelpfull) internal error it is
replacing.
I suggest for example "Invalid array reference of a non-array entity at
%L".

yes, that's much better!  The attached updated patch uses this.

Committed: r13-1757-gf838d15641d256e21ffc126c3277b290ed743928


gfortran's behavior during error handling is difficult to understand.
While the proposed new error message is emitted for associate_54.f90,
it never makes it far enough for the testcase of the present PR
(associate_59.f90).

Indeed.  We try to match several types of statement one after the other,
and each failed match can possibly register an error.  But it is emitted
only if all have failed (see gfc_error_check).  There is no choice of
the best error; the last one registered wins.

This buffering behavior is controlled by calls to gfc_buffer_error(...).
  Error handling during resolution doesn’t need to delay error reporting
as far as I know, and the calls to gfc_buffer_error (false) seem to
correctly disable buffering at the end of every call to next_statement.
  I don’t know why it remains active in this case.


Alright, I should try to remember this and take a closer look next time
I get confused about not getting the error message I wanted...

Thanks,
Harald

Reply via email to