MINGW-packages: flang does not compile code with complex pow

This simple test case fails to build with flang:

$ cat pow_z_failure.f90
!
! flang pow_z_failure.f90 -o pow_z_failure
!

program pow_z_failure
  implicit none

  complex :: z

  z = (1,0)

  print *, 'Hello!', z**2

end program pow_z_failure

$ flang -v pow_z_failure.f90 -o pow_z_failure
flang-new version 15.0.5
Target: x86_64-w64-windows-gnu
Thread model: posix
InstalledDir: C:/msys64/mingw64/bin
 "C:/msys64/mingw64/bin/flang-new" -fc1 -triple x86_64-w64-windows-gnu -emit-obj -fcolor-diagnostics -o C:/msys64/tmp/pow_z_failure-be33f8.o -x f95-cpp-input pow_z_failure.f90
 "C:/msys64/mingw64/bin/ld" -m i386pep -Bdynamic -o pow_z_failure.exe C:/msys64/mingw64/lib/crt2.o C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/12.2.0/crtbegin.o -LC:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/12.2.0 -LC:/msys64/mingw64/x86_64-w64-mingw32/lib -LC:/msys64/mingw64/x86_64-w64-mingw32/mingw/lib -LC:/msys64/mingw64/lib -LC:/msys64/mingw64/x86_64-w64-mingw32/sys-root/mingw/lib -LC:/msys64/mingw64/lib/clang/15.0.5/lib/windows C:/msys64/tmp/pow_z_failure-be33f8.o -lFortran_main -lFortranRuntime -lFortranDecimal -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt -lkernel32 C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/12.2.0/crtend.o
C:/msys64/mingw64/bin/ld: C:/msys64/tmp/pow_z_failure-be33f8.o: in function `_QQmain':
C:/msys64/home/angelo/programming/misc.apps/./pow_z_failure.f90:12: undefined reference to `__fc_powi_1'
flang: error: linker command failed with exit code 1 (use -v to see invocation)

MSYS2 is uptodate (pacman -Syu)…

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 20 (11 by maintainers)

Most upvoted comments

@mmuetzel , maybe you have closed this too soon:

$ flang -v pow_z_failure.f90 -o pow_z_failure
flang version 17.0.1
Target: x86_64-w64-windows-gnu
Thread model: posix
InstalledDir: C:/msys64/mingw64/bin
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: C:\\msys64\\mingw64\\bin\\flang.exe -v pow_z_failure.f90 -o pow_z_failure
Exception Code: 0xC0000005
 #0 0x00007ffc5cf8d671 (C:\msys64\mingw64\bin\libclang-cpp.dll+0x271d671)
 #1 0x00007ffc5cfc9b0a (C:\msys64\mingw64\bin\libclang-cpp.dll+0x2759b0a)
 #2 0x00007ffc5cfc202d (C:\msys64\mingw64\bin\libclang-cpp.dll+0x275202d)
 #3 0x00007ffc5cfc8b72 (C:\msys64\mingw64\bin\libclang-cpp.dll+0x2758b72)
 #4 0x00007ffc5cfc202d (C:\msys64\mingw64\bin\libclang-cpp.dll+0x275202d)
 #5 0x00007ffc5cfcb34d (C:\msys64\mingw64\bin\libclang-cpp.dll+0x275b34d)
 #6 0x00007ffc5c6a6884 (C:\msys64\mingw64\bin\libclang-cpp.dll+0x1e36884)
 #7 0x00007ff77c6a1f1b (C:\msys64\mingw64\bin\flang.exe+0x1f1b)
 #8 0x00007ff77c6a12ee (C:\msys64\mingw64\bin\flang.exe+0x12ee)
 #9 0x00007ff77c6a1406 (C:\msys64\mingw64\bin\flang.exe+0x1406)
#10 0x00007ffca4fe7344 (C:\WINDOWS\System32\KERNEL32.DLL+0x17344)
#11 0x00007ffca5e226b1 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x526b1)
Segmentation fault

wait a sec… flang is 64 bit only now whaaat ok that explains it.