Open
Description
I was testing Flang 20 (commit: 7cbb365) in a CMake project. When using the Ninja build system, it will always run the preprocessor over the files and then compile the preprocessed result.
The preprocessor will escape the backslashes but the compiler will not re-combine them, resulting in a duplication of backslashes.
MWE (named test.f90
):
program main
implicit none
write(*,*) "\"
end program main
Run:
flang -cpp -E test.f90 > test-pp.f90
flang test-pp.f90
./a.out
Expected result:
\
Result shown:
\\
If just the compile stages are provided the flag -fbackslash
the result becomes correct. If both are provided -fbackslash
it fails as the original string is unescaped.