I discovered an odd failure while attempting to port a large (mostly-)Fortran project to cmake+ninja under Msys2.
The failure is clearly in the Fortran source code parser attempting to search for “module” statements, which misfires on the line in my codebase:
call io_abort("Error in "//subroutine_name//": attempting to initialise ion_ion &
&module when module has already been initialised.")
The parser erroneously imagines it spots the start of a new module, failing to notice that the text “module when” is part of a quoted string, continued from the previous line. This generates a .ddi file containing
"provides" :
[
{
"compiled-module-path" : "mod/ion_ion.mod",
"logical-name" : "ion_ion.mod"
}
{
"compiled-module-path" : "mod/when.mod",
"logical-name" : "when.mod"
}
],
and ultimately leads to an aborted build with
ninja: build stopped: multiple rules generate mod/when.mod.
This failure occurs in msys2/ucrt64 on Windows 10 with cmake 2.24.2 and ninja 1.11.1. It is specific to the cmake-24.2 series; fortunately I have been able to test 23.x and 25.x, which turn out to be free of this issue. It is also specific to Windows and MSYS2, and can not be reproduced on linux with the same versions of cmake.
I wondered if the failure to detect a continued quoted string might be due to some issue with regexp matching and windows like endings? (However running unix2dos on the test file makes no difference). Any thoughts/suggestions welcome.
This is easily reproduced in this testcase
Keith Refson