public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* gfortran-14.1.1: issue with -Jpath search order
@ 2024-06-05 1:35 Satish Balay
0 siblings, 0 replies; only message in thread
From: Satish Balay @ 2024-06-05 1:35 UTC (permalink / raw)
To: bug-gcc
A test case:
>>>>>>>>>
$ ls
incdir/ moddir/ srcdir/
$ ls incdir/
$ ls moddir/
$ ls srcdir/
modtest.F90
$ cat srcdir/modtest.F90
module modtest
integer a
end module
program main
use modtest
end
$ gfortran --version
GNU Fortran (GCC) 14.1.1 20240522 (Red Hat 14.1.1-4)
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ strace --follow-forks -o trace.log gfortran -Jmoddir -Iincdir srcdir/modtest.F90
$
<<<<
From trace.log:
>>>>
231249 openat(AT_FDCWD, "moddir/modtest.mod", O_RDONLY) = -1 ENOENT (No such file or directory)
231249 unlink("moddir/modtest.mod") = -1 ENOENT (No such file or directory)
231249 rename("moddir/modtest.mod0", "moddir/modtest.mod") = 0
231249 openat(AT_FDCWD, "modtest.mod", O_RDONLY) = -1 ENOENT (No such file or directory)
231249 openat(AT_FDCWD, "srcdir/modtest.mod", O_RDONLY) = -1 ENOENT (No such file or directory)
231249 openat(AT_FDCWD, "incdir/modtest.mod", O_RDONLY) = -1 ENOENT (No such file or directory)
231249 openat(AT_FDCWD, "moddir/modtest.mod", O_RDONLY) = 5
<<<<
i.e after moddir/modtest.mod is created - its searched for in the following order:
- pwd
- src-file-dir
- -Ipath
- -Jpath
With this search order - a buggy/old/incorrect modtest.mod in pwd or src-file-dir gets picked up - resulting in broken builds.
Checking ifx from OneAPI - i see:
>>>>
$ ifx --version
ifx (IFORT) 2023.0.0 20221201
Copyright (C) 1985-2022 Intel Corporation. All rights reserved.
$ ifx --help |& grep -A2 \\-module
-module path
specify path where mod files should be placed and first location to
look for mod files
<<<<
Here with ifx - I don't get into the issue with picking up buggy/old/incorrect modtest.mod. With a slightly tweaked test:
>>>>>>>>
$ cat srcdir/modtest.F90
module modtest
integer a
end module
program main
use modtestwrong
end
$ strace --follow-forks -o trace.log ifx -module moddir -Iincdir srcdir/modtest.F90
srcdir/modtest.F90(5): error #7002: Error in opening the compiled module file. Check INCLUDE paths. [MODTESTWRONG]
use modtestwrong
----^
compilation aborted for srcdir/modtest.F90 (code 1)
$
<<<
trace.log has:
>>>
1573952 openat(AT_FDCWD, "moddir/modtestwrong.mod", O_RDONLY) = -1 ENOENT (No such file or directory)
1573952 openat(AT_FDCWD, "modtestwrong.mod", O_RDONLY) = -1 ENOENT (No such file or directory)
1573952 openat(AT_FDCWD, "srcdir/modtestwrong.mod", O_RDONLY) = -1 ENOENT (No such file or directory)
1573952 openat(AT_FDCWD, "./modtestwrong.mod", O_RDONLY) = -1 ENOENT (No such file or directory)
1573952 openat(AT_FDCWD, "incdir/modtestwrong.mod", O_RDONLY) = -1 ENOENT (No such file or directory)
...
<<<<
[i.e; -Jpath is searched first, then pwd, src-file-dir, ./, -Ipath, ...]
So is this a bug in gfortran?
thanks,
Satish
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-06-05 1:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-05 1:35 gfortran-14.1.1: issue with -Jpath search order Satish Balay
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).