]> git.ipfire.org Git - thirdparty/gcc.git/commit
fortran: Fix bogus warning with -cpp -fpreprocessed [PR92613]
authorChristopher Albert <albert@tugraz.at>
Thu, 4 Dec 2025 13:08:10 +0000 (14:08 +0100)
committerHarald Anlauf <anlauf@gmx.de>
Fri, 19 Dec 2025 17:29:36 +0000 (18:29 +0100)
commit15ffee4e129937c07190bc2ce059470bbd8068ae
treefce4e0099a633cd384d2d87d02b3d51e369ec2a5
parent38d15216dbff426747b860e5e2e12f8f9ec60de2
fortran: Fix bogus warning with -cpp -fpreprocessed [PR92613]

With -fpreprocessed, gfortran skips the C preprocessor, avoiding
spurious diagnostics about characters in Fortran comments.

PR fortran/92613

gcc/fortran/ChangeLog:

* cpp.cc (gfc_cpp_preprocess): Skip libcpp for -fpreprocessed.
Error out for -fpreprocessed -E.
* f95-lang.cc (gfc_init): Skip libcpp init for -fpreprocessed.
* scanner.cc (gfc_new_file): Load source directly if preprocessed.
* invoke.texi (Preprocessing Options): Document -fpreprocessed.

gcc/testsuite/ChangeLog:

* gfortran.dg/pr92613.f90: New test.
* gfortran.dg/pr92613_2.f90: New test for -E error.

Signed-off-by: Christopher Albert <albert@tugraz.at>
gcc/fortran/cpp.cc
gcc/fortran/f95-lang.cc
gcc/fortran/invoke.texi
gcc/fortran/scanner.cc
gcc/testsuite/gfortran.dg/pr92613.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/pr92613_2.f90 [new file with mode: 0644]