https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44491
--- Comment #5 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Dominique d'Humieres from comment #4)
> Compiling the test in comment 0 with 5.2.0 or trunk gives an ICE
>
> in gfc_format_decoder, at fortran/error.c:936
There is an assert at that line:
gcc_assert (loc->nextc - loc->lb->line >= 0);
why is it not true?
This predates my changes, since the original code did not have a correct
location there either, that is why it printed
if (l1 == NULL || l1->lb == NULL)
{
error_printf ("<During initialization>\n");
return;
}
If printing that is the correct behavior (which the original reporter thinks is
not), then the assert needs to be replaced with something else. When Tobias and
I moved Fortran to the common diagnostics, it was not clear what should happen
with some Fortran specific codes (like the one that handles "<During
initialization>"). The code is still there, but it is not used anymore.
Ideally, Fortran devs should decide what behavior they expect and figure out a
way to implement this behavior. I'm certain it is possible with either no or
minimal changes to the common diagnostics. In this case, it is a matter of
implementing whatever behavior Fortran wants on either gfc_diagnostic_starter
or gfc_diagnostic_finalizer.
(Have you tried patch in comment #2?)