Hi gcc-patches mailing list,
Peter0x44 via Sourceware Forge <[email protected]> 
has requested that the following forgejo pull request
be published on the mailing list.

Created on: 2026-06-07 18:44:21+00:00
Latest update: 2026-06-07 18:55:28+00:00
Changes: 2 changed files, 2 additions, 2 deletions
Head revision: Peter0x44/gcc-TEST ref libgomp-gfortran-path commit 
34e539bd4b214e15d1539fecc123f6671236c7e9
Base revision: gcc/gcc-TEST ref trunk commit 
bc4d9b6aeb314766aa288f68bc75d865edd46e21 r17-1408-gbc4d9b6aeb3147
Merge base: bc4d9b6aeb314766aa288f68bc75d865edd46e21
Full diff url: https://forge.sourceware.org/gcc/gcc-TEST/pulls/172.diff
Discussion:  https://forge.sourceware.org/gcc/gcc-TEST/pulls/172
Requested Reviewers:

The gfortran detection logic in libgomp's configure uses
"test -x" to check whether the $GFORTRAN program is executable.
However, "test -x" only succeeds for absolute or relative paths that
name an existing file; it fails for bare program names (e.g.
"x86_64-w64-mingw32-gfortran") that are found via $PATH lookup.

This causes FC to be incorrectly set to "no" in cross-compilation
environments where $GFORTRAN is a bare command name rather than a
full path.  As a result, the Fortran OpenMP module (omp_lib.mod) is
never installed, and programs that "use omp_lib" fail with:

  Fatal Error: Cannot open module file 'omp_lib.mod' for reading

The fix adds a "command -v" fallback for testing whether a command
is available on $PATH.

The bug was introduced in r0-98199-g2122aa973ed
(2010-01-26), so the Fortran OpenMP module has been missing from
cross-compiled installs for 16 years.

libgomp/ChangeLog:

        * configure.ac: Also accept $GFORTRAN when it can be found
        via PATH lookup using "command -v", not only when "test -x"
        succeeds on the bare name.
        * configure: Regenerate.


Changed files:
- M: libgomp/configure
- M: libgomp/configure.ac


Peter Damianov (1):
  libgomp: Fix gfortran detection when program is found via PATH

 libgomp/configure    | 2 +-
 libgomp/configure.ac | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

-- 
2.54.0

Reply via email to