https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120784
Bug ID: 120784 Summary: fortran: issue with use-association renames and interface Product: gcc Version: 15.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: matthew.thompson at nasa dot gov Target Milestone: --- Created attachment 61691 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61691&action=edit Reproducer for bug NOTE: I'm not sure what to title this. I've tried my best, but the Fortran guru who found this is out of comms for a bit. We have encountered what we believe is a compile-time but in gfortran. NAG Fortran, ifx, lfortran and even llvm flang seem okay with this code. Our conclusion is gfortran must be doing something wrong. Indeed, per godbolt, every version of GNU Fortran seems to have an issue with it. I've attached the reproducer and: ❯ gfortran-14 -v -save-temps -c test.F90 Using built-in specs. COLLECT_GCC=gfortran-14 Target: aarch64-apple-darwin24 Configured with: ../configure --prefix=/Users/mathomp4/.homebrew/brew/opt/gcc@14 --libdir=/Users/mathomp4/.homebrew/brew/opt/gcc@14/lib/gcc/14 --disable-nls --enable-checking=release --with-gcc-major-version-only --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-14 --with-gmp=/Users/mathomp4/.homebrew/brew/opt/gmp --with-mpfr=/Users/mathomp4/.homebrew/brew/opt/mpfr --with-mpc=/Users/mathomp4/.homebrew/brew/opt/libmpc --with-isl=/Users/mathomp4/.homebrew/brew/opt/isl --with-zstd=/Users/mathomp4/.homebrew/brew/opt/zstd --with-pkgversion='Homebrew GCC 14.3.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --with-system-zlib --build=aarch64-apple-darwin24 --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 14.3.0 (Homebrew GCC 14.3.0) COLLECT_GCC_OPTIONS='-v' '-save-temps' '-c' '-mmacosx-version-min=15.5' '-asm_macosx_version_min=15.5' '-nodefaultexport' '-mcpu=apple-m1' '-mlittle-endian' '-mabi=lp64' /Users/mathomp4/.homebrew/brew/Cellar/gcc@14/14.3.0/bin/../libexec/gcc/aarch64-apple-darwin24/14/f951 test.F90 -cpp=test.fii -quiet -v -iprefix /Users/mathomp4/.homebrew/brew/Cellar/gcc@14/14.3.0/bin/../lib/gcc/14/gcc/aarch64-apple-darwin24/14/ -D__DYNAMIC__ test.F90 -fPIC -quiet -dumpbase test.F90 -dumpbase-ext .F90 -mmacosx-version-min=15.5 -mcpu=apple-m1 -mlittle-endian -mabi=lp64 -version -fintrinsic-modules-path /Users/mathomp4/.homebrew/brew/Cellar/gcc@14/14.3.0/bin/../lib/gcc/14/gcc/aarch64-apple-darwin24/14/finclude -o test.s GNU Fortran (Homebrew GCC 14.3.0) version 14.3.0 (aarch64-apple-darwin24) compiled by GNU C version 14.3.0, GMP version 6.3.0, MPFR version 4.2.2, MPC version 1.3.1, isl version isl-0.27-GMP GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 ignoring nonexistent directory "/Users/mathomp4/.homebrew/brew/Cellar/gcc@14/14.3.0/bin/../lib/gcc/14/gcc/aarch64-apple-darwin24/14/../../../../../../aarch64-apple-darwin24/include" ignoring duplicate directory "/Users/mathomp4/.homebrew/brew/Cellar/gcc@14/14.3.0/bin/../lib/gcc/14/gcc/../../../../lib/gcc/14/gcc/aarch64-apple-darwin24/14/include" ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/local/include" ignoring duplicate directory "/Users/mathomp4/.homebrew/brew/Cellar/gcc@14/14.3.0/bin/../lib/gcc/14/gcc/../../../../lib/gcc/14/gcc/aarch64-apple-darwin24/14/include-fixed" ignoring nonexistent directory "/Users/mathomp4/.homebrew/brew/Cellar/gcc@14/14.3.0/bin/../lib/gcc/14/gcc/../../../../lib/gcc/14/gcc/aarch64-apple-darwin24/14/../../../../../../aarch64-apple-darwin24/include" #include "..." search starts here: #include <...> search starts here: /Users/mathomp4/.homebrew/brew/Cellar/gcc@14/14.3.0/bin/../lib/gcc/14/gcc/aarch64-apple-darwin24/14/finclude /Users/mathomp4/.homebrew/brew/Cellar/gcc@14/14.3.0/bin/../lib/gcc/14/gcc/aarch64-apple-darwin24/14/include /Users/mathomp4/.homebrew/brew/Cellar/gcc@14/14.3.0/bin/../lib/gcc/14/gcc/aarch64-apple-darwin24/14/include-fixed /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include End of search list. test.F90:27:22: 27 | end interface MyGet | 1 Error: Expecting 'END INTERFACE get' at (1) test.F90:29:8: 29 | contains | 1 Error: Unexpected CONTAINS statement in INTERFACE block at (1) test.F90:33:13: 33 | c = 'a' | 1 Error: Unexpected assignment statement at (1) in INTERFACE body test.F90:36:3: 36 | end module B_MOD | 1 Error: Expecting END INTERFACE statement at (1) f951: Error: Unexpected end of file in 'test.F90'