[Bug fortran/114922] fsyntax-only need the modules
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114922 --- Comment #5 from Axel Ehrich --- Thank you for the explanation. This resolves the issue.
[Bug fortran/114922] fsyntax-only need the modules
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114922 --- Comment #3 from Axel Ehrich --- The question is related to the actual purpose of the option -fsyntax only: In my understanding, the intention of the option -fsyntax-only is to construct the module files needed to compile the code. A build process would involve two steps: Step 1: construct all module files with gfortran -fsyntax only. Step 2: construct the object files without this option, while relying on the presence of all module files. (I have found this recipe on the internet and consider it valuable.) Alternatively, the purpose of -fsyntax-only could be to save compile time by a doing quick first check before entering the time consuming parts of the compilation. If this syntax check goes so far that it requires the module files already, the goal mentioned above cannot be reached.
[Bug fortran/114922] New: fsyntax-only need the modules
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114922 Bug ID: 114922 Summary: fsyntax-only need the modules Product: gcc Version: 13.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: axel.ehr...@tu-clausthal.de Target Milestone: --- Created attachment 58087 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58087&action=edit Short Example for this problem I encounter the following problem with gfortran: When I try to compile a file (such as the one attached) with the options -c -fsyntax-only, that is "gfortran -c -fsyntax-only syntax-only_test.f90" I receive the following error message: -- syntax-only_test.f90:2:5: 2 | use module | 1 Fatal Error: Cannot open module file 'module.mod' for reading at (1): No such file or directory compilation terminated. --- One purpose of the option "-fsyntax-only" is to create the module files (.mod), however, without doing the compilation that would require module files. The observed behaviour appears like a bug in gfortran. I used https://aoterodelaroza.github.io/devnotes/modern-fortran-makefiles/ to look how i can solve the problem with the depends of mod files. Best regards, Axel