Bug 2308835

Summary: clang: fatal error: error in backend: when compiling simde-0.8.2 tests
Product: [Fedora] Fedora Reporter: Dominik 'Rathann' Mierzejewski <dominik>
Component: clangAssignee: Tom Stellard <tstellar>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 42CC: airlied, dan, fedora-llvm-team, jchecahi, kkleine, npopov, sergesanspaille, siddharth.kde, suraj.ghimire7, tbaeder, tstellar, tuliom
Target Milestone: ---   
Target Release: ---   
Hardware: ppc64le   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1071880    

Description Dominik 'Rathann' Mierzejewski 2024-09-01 08:45:27 UTC
Description of problem:
When building simde-0.8.2 tests, I'm getting a fatal error.

Version-Release number of selected component (if applicable):
18.1.8-3.fc41

How reproducible:
Always.

Steps to Reproduce:
1. Build simde-0.8.2 on ppc64le.

Actual results:
fatal error: error in backend: Cannot select: 0x134b928c0: v2f64 = froundeven 0x134ab28e0, ../../simde/x86/avx512/round.h:207:25 @[ ../../test/x86/avx512/round.c:316:9 ]
  0x134ab28e0: v2f64,ch = PPCISD::XXSWAPD 0x134b6b3f0:1, 0x134b6b3f0, ../../test/x86/avx512/../../../simde/x86/avx512/loadu.h:67:5 @[ ../../test/x86/avx512/round.c:313:9 ]
    0x134b6b3f0: v2f64,ch = PPCISD::LXVD2X<(invariant load (s128) from %ir.20 + 32, align 8, !noalias !582)> 0x134d9de70, 0x134ab2720, ../../test/x86/avx512/../../../simde/x86/avx512/loadu.h:67:5 @[ ../../test/x86/avx512/round.c:313:9 ]
      0x134ab2720: i64 = add nuw 0x134ab31a0, Constant:i64<32>, ../../test/x86/avx512/../../../simde/x86/avx512/loadu.h:67:5 @[ ../../test/x86/avx512/round.c:313:9 ]
        0x134ab31a0: i64 = add 0x134ab2db0, 0x134cb2c40, ../../test/x86/avx512/../../../simde/x86/avx512/loadu.h:67:5 @[ ../../test/x86/avx512/round.c:313:9 ]
          0x134ab2db0: i64,ch = PPCISD::TOC_ENTRY<(load (s64) from got)> TargetGlobalAddress:i64<ptr @test_simde_x_mm512_round_pd.test_vec> 0, Register:i64 $x2, ../../test/x86/avx512/../../../simde/x86/avx512/loadu.h:67:5 @[ ../../test/x86/avx512/round.c:313:9 ]
            0x134b92230: i64 = TargetGlobalAddress<ptr @test_simde_x_mm512_round_pd.test_vec> 0, ../../test/x86/avx512/../../../simde/x86/avx512/loadu.h:67:5 @[ ../../test/x86/avx512/round.c:313:9 ]
            0x134b92770: i64 = Register $x2
          0x134cb2c40: i64,ch = CopyFromReg 0x134d9de70, Register:i64 %3, ../../test/x86/avx512/../../../simde/x86/avx512/loadu.h:67:5 @[ ../../test/x86/avx512/round.c:313:9 ]
            0x134b92a10: i64 = Register %3
        0x134cb2230: i64 = Constant<32>
In function: test_simde_x_mm512_round_pd
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: clang -Itest/x86/avx512/round-emul-c.p -Itest/x86/avx512 -I../../test/x86/avx512 -I. -I../.. -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c99 -O0 -g -O2 -flto=thin -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS --config=/usr/lib/rpm/redhat/redhat-hardened-clang.cfg -fstack-protector-strong -m64 -mcpu=power8 -mtune=power8 -fasynchronous-unwind-tables -fstack-clash-protection -fno-strict-aliasing -fopenmp-simd -DSIMDE_CONSTRAINED_COMPILATION -DSIMDE_ENABLE_OPENMP -Wno-psabi -DSIMDE_TEST_BARE -DSIMDE_NO_NATIVE -MD -MQ test/x86/avx512/round-emul-c.p/round.c.o -MF test/x86/avx512/round-emul-c.p/round.c.o.d -o test/x86/avx512/round-emul-c.p/round.c.o -c ../../test/x86/avx512/round.c
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module '../../test/x86/avx512/round.c'.
4.	Running pass 'PowerPC DAG->DAG Pattern Instruction Selection' on function '@test_simde_x_mm512_round_pd'
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  libLLVM.so.18.1      0x00007fff782b9924 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 132
1  libLLVM.so.18.1      0x00007fff782ba188
2  libLLVM.so.18.1      0x00007fff782b6970 llvm::sys::RunSignalHandlers() + 192
3  libLLVM.so.18.1      0x00007fff782b88c0 llvm::sys::CleanupOnSignal(unsigned long) + 448
4  libLLVM.so.18.1      0x00007fff781abd10
5  libLLVM.so.18.1      0x00007fff781abc90 llvm::CrashRecoveryContext::HandleExit(int) + 32
6  libLLVM.so.18.1      0x00007fff782b2030 llvm::sys::Process::Exit(int, bool) + 144
7  clang                0x000000011d4abaf0
8  libLLVM.so.18.1      0x00007fff781c393c llvm::report_fatal_error(llvm::Twine const&, bool) + 396
9  libLLVM.so.18.1      0x00007fff78e07614 llvm::SelectionDAGISel::CannotYetSelect(llvm::SDNode*) + 1156
10 libLLVM.so.18.1      0x00007fff78e067e4 llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) + 16452
11 libLLVM.so.18.1      0x00007fff7b96ed14
12 libLLVM.so.18.1      0x00007fff78dfc1e8 llvm::SelectionDAGISel::DoInstructionSelection() + 408
13 libLLVM.so.18.1      0x00007fff78dfb628 llvm::SelectionDAGISel::CodeGenAndEmitDAG() + 1064
14 libLLVM.so.18.1      0x00007fff78dfb1c4 llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, false, false, void, true>, false, true>, llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, false, false, void, true>, false, true>, bool&) + 772
15 libLLVM.so.18.1      0x00007fff78dfa6ec llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) + 7180
16 libLLVM.so.18.1      0x00007fff78df7a5c llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 3036
17 libLLVM.so.18.1      0x00007fff7b965cec
18 libLLVM.so.18.1      0x00007fff7882076c llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 1420
19 libLLVM.so.18.1      0x00007fff784afce0 llvm::FPPassManager::runOnFunction(llvm::Function&) + 1184
20 libLLVM.so.18.1      0x00007fff784b95a4 llvm::FPPassManager::runOnModule(llvm::Module&) + 84
21 libLLVM.so.18.1      0x00007fff784b0774 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 1492
22 libLLVM.so.18.1      0x00007fff784b9adc llvm::legacy::PassManager::run(llvm::Module&) + 28
23 libclang-cpp.so.18.1 0x00007fff8120c034 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) + 11668
24 libclang-cpp.so.18.1 0x00007fff816577dc clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 1948
25 libclang-cpp.so.18.1 0x00007fff7f9eff80 clang::ParseAST(clang::Sema&, bool, bool) + 864
26 libclang-cpp.so.18.1 0x00007fff82524f60 clang::ASTFrontendAction::ExecuteAction() + 272
27 libclang-cpp.so.18.1 0x00007fff8165d4a8 clang::CodeGenAction::ExecuteAction() + 296
28 libclang-cpp.so.18.1 0x00007fff82524528 clang::FrontendAction::Execute() + 152
29 libclang-cpp.so.18.1 0x00007fff82493e78 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 1016
30 libclang-cpp.so.18.1 0x00007fff825c3538 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 664
31 clang                0x000000011d4ab6c4 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 6436
32 clang                0x000000011d4a7740
33 libclang-cpp.so.18.1 0x00007fff8202da28
34 libLLVM.so.18.1      0x00007fff781abc34 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) + 212
35 libclang-cpp.so.18.1 0x00007fff8202d148 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const + 376
36 libclang-cpp.so.18.1 0x00007fff81feb1cc clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const + 1020
37 libclang-cpp.so.18.1 0x00007fff81feb4c4 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const + 212
38 libclang-cpp.so.18.1 0x00007fff8200c6c0 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) + 704
39 clang                0x000000011d4a6e88 clang_main(int, char**, llvm::ToolContext const&) + 12584
40 clang                0x000000011d4b63dc main + 108
41 libc.so.6            0x00007fff7741110c
42 libc.so.6            0x00007fff7741134c __libc_start_main + 428
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 18.1.8 (Fedora 18.1.8-3.fc41)
Target: ppc64le-redhat-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Configuration file: /etc/clang/ppc64le-redhat-linux-gnu-clang.cfg
Configuration file: /usr/lib/rpm/redhat/redhat-hardened-clang.cfg

Expected results:
Successful build.

Comment 1 Dominik 'Rathann' Mierzejewski 2024-09-01 09:01:18 UTC
Koji scratch build: https://koji.fedoraproject.org/koji/taskinfo?taskID=122755468

The src.rpm comes from this PR: https://src.fedoraproject.org/rpms/simde/pull-request/15
and you need to comment out https://src.fedoraproject.org/rpms/simde/pull-request/15#_6__70
to build the tests with clang on ppc64le.

Comment 2 Tulio Magno Quites Machado Filho 2024-10-01 21:57:47 UTC
I managed to reduce the code and reported the issue upstream: https://github.com/llvm/llvm-project/issues/110753

Comment 3 Aoife Moloney 2025-02-26 13:11:24 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 42 development cycle.
Changing version to 42.