| Issue |
240694
|
| Summary |
[flang] Flang on macOS arm64 cannot link `bessel_j0(real32)`
|
| Labels |
flang
|
| Assignees |
|
| Reporter |
han190
|
With Flang 23 on macOS arm64, this standalone program compiles but fails to link:
```fortran
program main
use, intrinsic :: iso_fortran_env, only: real32
implicit none
real(real32) :: x
read (*, *) x
print *, bessel_j0(x)
end program main
```
run `flang main.f90 -o main && ./main` generates
```text
main.f90:7:12: warning: bessel_j0(real(kind=4)) cannot be folded on host [-Wfolding-failure]
print *, bessel_j0(x)
^^^^^^^^^^^^
ld: warning: building for macOS-27.0, but linking with dylib '/opt/homebrew/opt/flang/lib/clang/23/lib/darwin/libflang_rt.runtime.dylib' which was built for newer version 27.2
Undefined symbols for architecture arm64:
"_j0f", referenced from:
__QQmain in main-a2939e.o
ld: symbol(s) not found for architecture arm64
flang-23: error: linker command failed with exit code 1 (use -v to see invocation)
```
Convert `x` to real64 works.
```
Homebrew flang version 23.1.5
Target: arm64-apple-darwin27.0.0
Thread model: posix
InstalledDir: /opt/homebrew/Cellar/flang/23.1.5/bin
Configuration file: /opt/homebrew/Cellar/flang/23.1.5/etc/clang/arm64-apple-darwin27.cfg
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs