[clang] [flang] [flang] Preserve fixed form in fc1 -x value (PR #117563)
David Truby via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 26 17:06:34 PST 2024
DavidTruby wrote:
`-save-temps` doesn't appear to work for me at all, I get the following error:
```
"S:\\llvm-project\\build\\bin\\flang.exe" -cc1as -triple x86_64-pc-windows-msvc19.41.34123 -filetype obj -main-file-name test.f90 -target-cpu x86-64 "-fdebug-compilation-dir=S:\\llvm-project\\build" -dwarf-version=4 -mrelocation-model pic -mincremental-linker-compatible -o test.o test.s
error: unknown integrated tool '-cc1as'. Valid tools include '-fc1'.
```
Is it something we are expecting to work with the flang compiler driver? (I suppose it should be disabled if not).
Anyways, I think to fix the specific issue you're reporting here, an easier method is rely on the fact that the "preprocessed" output from flang will always be fixed form, regardless of what form the input was in. So instead of modifying `Types.def` you can add ".i" to the suffixes where fixed-format is assumed here: https://github.com/llvm/llvm-project/blob/main/flang/lib/Frontend/FrontendOptions.cpp#L21-L22.
It feels wrong that `-save-temps` runs the preprocessor separately anyway for flang. There's no "temp" generated by the flang preprocessor as preprocessing is not a separate step to parsing. We don't appear to need to do this for compatibility with gfortran either because gfortran doesn't appear to save a preprocessed file with `-save-temps` (at least on my system). Even if we _do_ chose to have `-save-temps` save a preprocessed file for some reason, I think `.i` is the wrong extension as that's usually used for C/C++ preprocessed files.
Does your use case specifically require `-save-temps` to save a preprocessed file, and if so does it have to have the `.i` extension?
https://github.com/llvm/llvm-project/pull/117563
More information about the cfe-commits
mailing list