[Bug fortran/81615] New: save-temps and gfortran produces *.f90 files instead of *.i or *i90 files
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81615 Bug ID: 81615 Summary: save-temps and gfortran produces *.f90 files instead of *.i or *i90 files Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: barrowes at alum dot mit.edu Target Milestone: --- If I have a file test1.f: program test2 real x x=3.0 C#ifdef DDD C x=2.0 C#endif print *,'x=',x end and I compile it with: gfortran -save-temps -o test0 test0.f I get two temporary files, test0.o and test0.s. If I uncomment the directive: program test2 real x x=3.0 #ifdef MPI x=2.0 #endif print *,'x=',x end and compile with: gfortran -cpp -save-temps -o test0 test0.f In addition to the two temporary files above, a test0.f90 is produced that looks like: # 1 "test0.f" # 1 "" # 1 "" # 1 "test0.f" program test2 real x x=3.0 print *,'x=',x end I was under the impression that I would get a test0.i file since the only documentation of using -save-temps I can find comes from the gcc docs: https://gcc.gnu.org/onlinedocs/gcc/Developer-Options.html#index-save-temps which mentions *.i files in their example. And if I have a file test1.f90: program test1 real x x=3.0 #ifdef MPI x=2.0 #endif print *,'x=',x end and I compile with: gfortran -cpp -save-temps -o test1 test1.f90 The test1.o and test1.s files are produced, but no preprocessed fortran source file is produced (I suppose because the source file already has the f90 extension). How can I get a preprocessed source file in this case? Where is this behavior of -save-temps producing *.f90 files documented? Can I change the f90 extension of the preprocessed temporary files to i or i90 instead of f90?
[Bug fortran/81615] save-temps and gfortran produces *.f90 files instead of *.i or *i90 files
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81615 --- Comment #2 from Ben Barrowes --- Then how does one get a preprocessed/savetemp file from an existing *.f90 file? In the case of C, preprocessed and temp files have different extensions and are thus easily identified after compiling. For gfortran, preprocessing/saveingtemps of *.f files produces *.f90 files which is confusing, and preprocessing/savetemps of *.f90 files produces no output. Gfortran needs to produce preprocessed/savetemps that have unique and easily identifiable extensions. If not *.i and *.i90, then something else like *.t and *.t90 or similar.
[Bug fortran/81615] save-temps and gfortran produces *.f90 files instead of *.i or *i90 files
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81615 --- Comment #4 from Ben Barrowes --- It has been a while. Is there any way to save the temporary preprocessed files in gfortran?
[Bug fortran/81615] save-temps and gfortran produces *.f90 files instead of *.i or *i90 files
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81615 --- Comment #6 from Ben Barrowes --- There are many cases where people do not use a capital "F", but still have preprocessor directives in the code. In these cases, no proprocessed file is written out right now, AFAIK. So perhaps as you suggest we could add a new suffix to the old filename. Then test1.f would become test.f.i and test1.f90 would also become test1.f.i, etc. Having this one rule would be a concise solution and have a guaranteed output in all cases.
[Bug fortran/81615] save-temps and gfortran produces *.f90 files instead of *.i or *i90 files
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81615 --- Comment #8 from Ben Barrowes --- Maybe *.fpp ?
[Bug fortran/81615] save-temps and gfortran produces *.f90 files instead of *.i or *i90 files
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81615 --- Comment #10 from Ben Barrowes --- The reason the stdout redirection doesn't work for me is because I want to save these preprocessed files during a "make" session. When I make, thousands of fotran files are preprocessed and compiled. How do I save the stdout from each one into its own directory?
[Bug fortran/81615] save-temps and gfortran produces *.f90 files instead of *.i or *i90 files
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81615 --- Comment #12 from Ben Barrowes --- I use these intermediate files during the software analysis process, but then delete them later. They are useful for me to have. When I am given a makefile, it is often 1000's loc. I am not sure I want to go in and modify it such as you suggest below and tell the customer it is for their own good. I'd rather be able to set a couple of switches to the preprocessor and get what I want. gfortran already allows to create a *.d file in each directory for each file. Is that poor software design as well? And when gfortran files are preprocessed all into a *.f90 file, except when they are not (see Thomas's email below), is that poor software design? ifort allows for the creation of these intermediate preprocessed files, creating *.i and *.i90 files. IBM XL allows this as well using the -d switch: https://www.ibm.com/docs/en/xl-fortran-aix/16.1.0?topic=preprocessor-passing-fortran-files-through-c And the intermediate filename becomes Ffilename.f* Can gfortran be modified to have the option to do this as well?
[Bug fortran/81615] save-temps and gfortran produces *.f90 files instead of *.i or *i90 files
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81615 --- Comment #14 from Ben Barrowes --- Thanks for engaging, and thanks for the suggestion. I might be able to do this over the winter. Could you give me a hint as to where to look. Which files.