[flang-commits] [flang] [flang] Modifications to ieee floating point environment procedures (PR #121949)
Rainer Orth via flang-commits
flang-commits at lists.llvm.org
Thu Jan 9 04:16:59 PST 2025
rorth wrote:
> > Besides, if you can tell me **exactly** what to check, I could do this for both Solaris and Linux. I think that would be better than blindly `XFAIL`ing the tests without understanding the issues.
>
> The two tests are executable Fortran tests. Output for both tests lists expected output on the left side of each line, and actual output on the right. Is that output correct?
If that's the case, shouldn't the tests check if they produce this expected output?
I get that output only on Linux/x86_64: I've just compiled the test with `flang -o ieee_femodes.exe ieee_femodes.f90` in all cases.
- On Linux/x86_64, it compiles, links and runs with the expected output.
- On Solaris/amd64, the test fails to link:
```
Undefined first referenced
symbol in file
ieee_get_modes_0_ /var/tmp/ieee_femodes-440ad6.o
ieee_set_modes_0_ /var/tmp/ieee_femodes-440ad6.o
```
Comparing the `.s` files between Linux and Solaris, I find that where Linux has a call to `fegetmode`, Solaris has one to `ieee_get_modes_0_` instead: not really astonishing since Solaris lacks TS 18661-1:2014 support. It would certainly be better if `flang` wouldn't generate calls to functions known not to exist here, though.
- On both Solaris/sparcv9 and Linux/sparc64, things are way worse, however: `flang` errors out like this:
```
LLVM ERROR: Cannot select: t137: ch = set_rounding t133, t253
t253: i32,ch = load<(dereferenceable invariant load (s8) from @_QQroX_QM__fortran_builtinsT__builtin_ieee_round_typeX1, align 8), sext from i8> t0, t287, undef:i64
t287: i64 = add t284, t286
t284: i64 = shl t283, Constant:i32<12>
t283: i64 = add t280, t282
t280: i64 = SPISD::Hi TargetGlobalAddress:i64<ptr @_QQroX_QM__fortran_builtinsT__builtin_ieee_round_typeX1> 0 [TF=3]
t279: i64 = TargetGlobalAddress<ptr @_QQroX_QM__fortran_builtinsT__builtin_ieee_round_typeX1> 0 [TF=3]
t282: i64 = SPISD::Lo TargetGlobalAddress:i64<ptr @_QQroX_QM__fortran_builtinsT__builtin_ieee_round_typeX1> 0 [TF=4]
t281: i64 = TargetGlobalAddress<ptr @_QQroX_QM__fortran_builtinsT__builtin_ieee_round_typeX1> 0 [TF=4]
t274: i32 = Constant<12>
t286: i64 = SPISD::Lo TargetGlobalAddress:i64<ptr @_QQroX_QM__fortran_builtinsT__builtin_ieee_round_typeX1> 0 [TF=5]
t285: i64 = TargetGlobalAddress<ptr @_QQroX_QM__fortran_builtinsT__builtin_ieee_round_typeX1> 0 [TF=5]
t1: i64 = undef
In function: _QQmain
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: tools/clang/stage2-bins/bin/flang -fc1 -triple sparcv9-sun-solaris2.11 -emit-obj -fcolor-diagnostics -mrelocation-model static -resource-dir tools/clang/stage2-bins/lib/clang/20 -mframe-pointer=all -o /var/tmp/ieee_femodes-b9df56.o -x f95-cpp-input /vol/llvm/src/llvm-project/local/flang/test/Lower/Intrinsics/ieee_femodes.f90
1. Running pass 'Function Pass Manager' on module 'FIRModule'.
2. Running pass 'SPARC DAG->DAG Pattern Instruction Selection' on function '@_QQmain'
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0 flang-20 0x00000001084fe65c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 36
1 flang-20 0x00000001084fef60 SignalHandler(int) + 896
2 libc.so.1 0xffffffff7eec6068 __sighndlr + 12
3 libc.so.1 0xffffffff7eeb8910 call_user_handler + 1024
4 libc.so.1 0xffffffff7eeb8d00 sigacthandler + 208
5 libc.so.1 0xffffffff7eecb180 __lwp_sigqueue + 8
6 libc.so.1 0xffffffff7ede933c abort + 252
7 flang-20 0x000000010846502c llvm::report_fatal_error(llvm::Twine const&, bool) + 836
8 flang-20 0x000000010afa78b0 llvm::SelectionDAGISel::CannotYetSelect(llvm::SDNode*) + 636
9 flang-20 0x000000010afa64ec llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) + 26512
10 flang-20 0x0000000107d22d50 (anonymous namespace)::SparcDAGToDAGISel::Select(llvm::SDNode*) + 5780
11 flang-20 0x000000010af98708 llvm::SelectionDAGISel::DoInstructionSelection() + 1756
12 flang-20 0x000000010af974b8 llvm::SelectionDAGISel::CodeGenAndEmitDAG() + 6792
13 flang-20 0x000000010af952a4 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) + 9176
14 flang-20 0x000000010af91980 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 932
15 flang-20 0x000000010af8ece8 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) + 216
16 flang-20 0x000000010c028f14 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 736
17 flang-20 0x000000010dd0c05c llvm::FPPassManager::runOnFunction(llvm::Function&) + 600
18 flang-20 0x000000010dd13d78 llvm::FPPassManager::runOnModule(llvm::Module&) + 68
19 flang-20 0x000000010dd0c800 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 1192
20 flang-20 0x00000001087cc9ec Fortran::frontend::CodeGenAction::executeAction() + 2928
21 flang-20 0x00000001085584f0 Fortran::frontend::FrontendAction::execute() + 12
22 flang-20 0x0000000108543670 Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) + 356
23 flang-20 0x000000010855d114 Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) + 5192
24 flang-20 0x0000000106762b6c fc1_main(llvm::ArrayRef<char const*>, char const*) + 784
25 flang-20 0x00000001067619d0 main + 5344
26 flang-20 0x0000000106760204 _start + 100
flang-20: error: unable to execute command: Abort (core dumped)
flang-20: error: flang frontend command failed due to signal (use -v to see invocation)
flang version 20.0.0git
Target: sparcv9-sun-solaris2.11
Thread model: posix
InstalledDir: tools/clang/stage2-bins/bin
Build config: +assertions
```
No idea if this is a SPARC backend bug or a bug in Flang.
https://github.com/llvm/llvm-project/pull/121949
More information about the flang-commits
mailing list