Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion llvm::isUIntN(BitWidth, val) && "Value is not an N-bit unsigned value" when building musl for mips64-linux-muslabi64 with Clang 20.1.0-rc1 #125954

Closed
alexrp opened this issue Feb 5, 2025 · 7 comments

Comments

@alexrp
Copy link
Member

alexrp commented Feb 5, 2025

To repro:

$ git clone https://git.musl-libc.org/git/musl
$ cd musl
$ make distclean && \
          ./configure --prefix=$(pwd)/build-all/mips64 --target=mips64-linux-muslabi64 --disable-static AR="llvm-ar" CC="clang --target=mips64-linux-muslabi64" RANLIB="llvm-ranlib" && \
          make -j$(nproc)
clang --target=mips64-linux-muslabi64 -std=c99 -nostdinc -ffreestanding -fexcess-precision=standard -frounding-math -fno-strict-aliasing -Wa,--noexecstack -D_XOPEN_SOURCE=700 -I./arch/mips64 -I./arch/generic -Iobj/src/internal -I./src/include -I./src/internal -Iobj/include -I./include  -O2 -fno-align-functions -pipe -fomit-frame-pointer -fno-unwind-tables -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections -w -Wno-pointer-to-int-cast -Werror=implicit-function-declaration -Werror=implicit-int -Werror=pointer-sign -Werror=pointer-arith -Werror=int-conversion -Werror=incompatible-pointer-types -Qunused-arguments -Waddress -Warray-bounds -Wchar-subscripts -Wduplicate-decl-specifier -Winit-self -Wreturn-type -Wsequence-point -Wstrict-aliasing -Wunused-function -Wunused-label -Wunused-variable  -fPIC -c -o obj/src/crypt/crypt_des.lo src/crypt/crypt_des.c
clang: /home/alexrp/Source/llvm-project/llvm/include/llvm/ADT/APInt.h:127: llvm::APInt::APInt(unsigned int, uint64_t, bool, bool): Assertion `llvm::isUIntN(BitWidth, val) && "Value is not an N-bit unsigned value"' failed.
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 --target=mips64-linux-muslabi64 -std=c99 -nostdinc -ffreestanding -fexcess-precision=standard -frounding-math -fno-strict-aliasing -Wa,--noexecstack -D_XOPEN_SOURCE=700 -I./arch/mips64 -I./arch/generic -Iobj/src/internal -I./src/include -I./src/internal -Iobj/include -I./include -O2 -fno-align-functions -pipe -fomit-frame-pointer -fno-unwind-tables -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections -w -Wno-pointer-to-int-cast -Werror=implicit-function-declaration -Werror=implicit-int -Werror=pointer-sign -Werror=pointer-arith -Werror=int-conversion -Werror=incompatible-pointer-types -Qunused-arguments -Waddress -Warray-bounds -Wchar-subscripts -Wduplicate-decl-specifier -Winit-self -Wreturn-type -Wsequence-point -Wstrict-aliasing -Wunused-function -Wunused-label -Wunused-variable -fPIC -c -o obj/src/crypt/crypt_des.lo src/crypt/crypt_des.c
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'src/crypt/crypt_des.c'.
4.      Running pass 'MIPS DAG->DAG Pattern Instruction Selection' on function '@_crypt_extended_r_uut'
 #0 0x0000758457b7ed12 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/alexrp/Source/llvm-project/llvm/lib/Support/Unix/Signals.inc:802:3
 #1 0x0000758457b7c6bf llvm::sys::RunSignalHandlers() /home/alexrp/Source/llvm-project/llvm/lib/Support/Signals.cpp:105:20
 #2 0x0000758457a82710 HandleCrash /home/alexrp/Source/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:73:5
 #3 0x0000758457a82710 CrashRecoverySignalHandler(int) /home/alexrp/Source/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:390:62
 #4 0x0000758456445320 (/lib/x86_64-linux-gnu/libc.so.6+0x45320)
 #5 0x000075845649eb1c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #6 0x000075845649eb1c __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #7 0x000075845649eb1c pthread_kill ./nptl/pthread_kill.c:89:10
 #8 0x000075845644526e raise ./signal/../sysdeps/posix/raise.c:27:6
 #9 0x00007584564288ff abort ./stdlib/abort.c:81:7
#10 0x000075845642881b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#11 0x000075845643b507 (/lib/x86_64-linux-gnu/libc.so.6+0x3b507)
#12 0x0000758457a1fef9 llvm::maxIntN(long) /home/alexrp/Source/llvm-project/llvm/include/llvm/Support/MathExtras.h:252:35
#13 0x0000758457a1fef9 llvm::isIntN(unsigned int, long) /home/alexrp/Source/llvm-project/llvm/include/llvm/Support/MathExtras.h:262:53
#14 0x0000758457a1fef9 llvm::APInt::APInt(unsigned int, unsigned long, bool, bool) /home/alexrp/Source/llvm-project/llvm/include/llvm/ADT/APInt.h:120:11
#15 0x000075845877d0b6 llvm::SelectionDAG::getConstant(llvm::APInt const&, llvm::SDLoc const&, llvm::EVT, bool, bool) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1674:39
#16 0x000075845877d0b6 llvm::SelectionDAG::getConstant(unsigned long, llvm::SDLoc const&, llvm::EVT, bool, bool) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1668:21
#17 0x000075845b83ed37 performORCombine /home/alexrp/Source/llvm-project/llvm/lib/Target/Mips/MipsISelLowering.cpp:1007:32
#18 0x000075845b83ed37 llvm::MipsTargetLowering::PerformDAGCombine(llvm::SDNode*, llvm::TargetLowering::DAGCombinerInfo&) const /home/alexrp/Source/llvm-project/llvm/lib/Target/Mips/MipsISelLowering.cpp:1231:28
#19 0x0000758458590936 combine /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:2039:10
#20 0x0000758458590936 (anonymous namespace)::DAGCombiner::combine(llvm::SDNode*) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:2019:9
#21 0x00007584585923f4 Run /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1798:5
#22 0x00007584585923f4 llvm::SelectionDAG::Combine(llvm::CombineLevel, llvm::BatchAAResults*, llvm::CodeGenOptLevel) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:29246:44
#23 0x00007584587b98cd llvm::TimeRegion::~TimeRegion() /home/alexrp/Source/llvm-project/llvm/include/llvm/Support/Timer.h:160:9
#24 0x00007584587b98cd llvm::NamedRegionTimer::~NamedRegionTimer() /home/alexrp/Source/llvm-project/llvm/include/llvm/Support/Timer.h:168:8
#25 0x00007584587b98cd llvm::SelectionDAGISel::CodeGenAndEmitDAG() /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1099:3
#26 0x00007584587bdef5 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1904:33
#27 0x00007584587bf5b9 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:616:22
#28 0x000075845b837f2e llvm::MipsDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) /home/alexrp/Source/llvm-project/llvm/lib/Target/Mips/MipsISelDAGToDAG.cpp:53:27
#29 0x00007584587afee7 llvm::OptLevelChanger::~OptLevelChanger() /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:269:11
#30 0x00007584587afee7 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:376:1
#31 0x00007584587afee7 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:347:6
#32 0x00007584580f83bf llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:94:33
#33 0x0000758457d43324 llvm::FPPassManager::runOnFunction(llvm::Function&) /home/alexrp/Source/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1416:7
#34 0x0000758457d43541 llvm::ilist_detail::node_base_prevnext<llvm::ilist_node_base<true, void>, true>::getNext() const /home/alexrp/Source/llvm-project/llvm/include/llvm/ADT/ilist_node_base.h:42:38
#35 0x0000758457d43541 llvm::ilist_node_impl<llvm::ilist_detail::node_options<llvm::Function, true, false, void, false, void>>::getNext() /home/alexrp/Source/llvm-project/llvm/include/llvm/ADT/ilist_node.h:117:66
#36 0x0000758457d43541 llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Function, true, false, void, false, void>, false, false>::operator++() /home/alexrp/Source/llvm-project/llvm/include/llvm/ADT/ilist_iterator.h:187:25
#37 0x0000758457d43541 llvm::FPPassManager::runOnModule(llvm::Module&) /home/alexrp/Source/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1451:22
#38 0x0000758457d43d8d runOnModule /home/alexrp/Source/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1528:7
#39 0x0000758457d43d8d llvm::legacy::PassManagerImpl::run(llvm::Module&) /home/alexrp/Source/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:539:55
#40 0x00007584638752e4 RunCodegenPipeline /home/alexrp/Source/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1229:9
#41 0x00007584638752e4 emitAssembly /home/alexrp/Source/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1252:21
#42 0x00007584638752e4 clang::emitBackendOutput(clang::CompilerInstance&, clang::CodeGenOptions&, 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*) /home/alexrp/Source/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1416:25
#43 0x0000758463d7075a llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>::release() /home/alexrp/Source/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:232:9
#44 0x0000758463d7075a llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>::~IntrusiveRefCntPtr() /home/alexrp/Source/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:196:34
#45 0x0000758463d7075a clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) /home/alexrp/Source/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:315:20
#46 0x00007584622cd15c clang::ParseAST(clang::Sema&, bool, bool) /home/alexrp/Source/llvm-project/clang/lib/Parse/ParseAST.cpp:184:34
#47 0x0000758464873b87 clang::FrontendAction::Execute() /home/alexrp/Source/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1076:38
#48 0x0000758464803f92 llvm::Error::getPtr() const /home/alexrp/Source/llvm-project/llvm/include/llvm/Support/Error.h:279:51
#49 0x0000758464803f92 llvm::Error::operator bool() /home/alexrp/Source/llvm-project/llvm/include/llvm/Support/Error.h:242:22
#50 0x0000758464803f92 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /home/alexrp/Source/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:1056:42
#51 0x000075846490a477 std::__shared_ptr<clang::FrontendOptions, (__gnu_cxx::_Lock_policy)2>::get() const /usr/include/c++/13/bits/shared_ptr_base.h:1666:16
#52 0x000075846490a477 std::__shared_ptr_access<clang::FrontendOptions, (__gnu_cxx::_Lock_policy)2, false, false>::_M_get() const /usr/include/c++/13/bits/shared_ptr_base.h:1363:69
#53 0x000075846490a477 std::__shared_ptr_access<clang::FrontendOptions, (__gnu_cxx::_Lock_policy)2, false, false>::operator*() const /usr/include/c++/13/bits/shared_ptr_base.h:1349:2
#54 0x000075846490a477 clang::CompilerInvocation::getFrontendOpts() /home/alexrp/Source/llvm-project/clang/include/clang/Frontend/CompilerInvocation.h:259:48
#55 0x000075846490a477 clang::CompilerInstance::getFrontendOpts() /home/alexrp/Source/llvm-project/clang/include/clang/Frontend/CompilerInstance.h:313:39
#56 0x000075846490a477 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /home/alexrp/Source/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:297:29
#57 0x00005bda66b8a1ec cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /home/alexrp/Source/llvm-project/clang/tools/driver/cc1_main.cpp:290:40
#58 0x00005bda66b824d9 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) /home/alexrp/Source/llvm-project/clang/tools/driver/driver.cpp:218:20
#59 0x00007584643f5e8d operator() /home/alexrp/Source/llvm-project/clang/lib/Driver/Job.cpp:437:32
#60 0x00007584643f5e8d void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) /home/alexrp/Source/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:46:52
#61 0x0000758457a8289e llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) /home/alexrp/Source/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:427:10
#62 0x00007584643f6eff clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) /home/alexrp/Source/llvm-project/clang/lib/Driver/Job.cpp:441:10
#63 0x00007584643b6f2b clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const /home/alexrp/Source/llvm-project/clang/lib/Driver/Compilation.cpp:197:3
#64 0x00007584643b73c6 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const /home/alexrp/Source/llvm-project/clang/lib/Driver/Compilation.cpp:251:5
#65 0x00007584643c9c54 llvm::SmallVectorBase<unsigned int>::empty() const /home/alexrp/Source/llvm-project/llvm/include/llvm/ADT/SmallVector.h:81:46
#66 0x00007584643c9c54 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) /home/alexrp/Source/llvm-project/clang/lib/Driver/Driver.cpp:2190:28
#67 0x00005bda66b85cd2 llvm::SmallVectorBase<unsigned int>::size() const /home/alexrp/Source/llvm-project/llvm/include/llvm/ADT/SmallVector.h:78:32
#68 0x00005bda66b85cd2 llvm::SmallVectorTemplateCommon<std::pair<int, clang::driver::Command const*>, void>::end() /home/alexrp/Source/llvm-project/llvm/include/llvm/ADT/SmallVector.h:269:41
#69 0x00005bda66b85cd2 clang_main(int, char**, llvm::ToolContext const&) /home/alexrp/Source/llvm-project/clang/tools/driver/driver.cpp:400:26
#70 0x00005bda66b81b3a main /home/alexrp/Source/llvm-project/build-20/tools/clang/tools/driver/clang-driver.cpp:18:1
#71 0x000075845642a1ca __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#72 0x000075845642a28b call_init ./csu/../csu/libc-start.c:128:20
#73 0x000075845642a28b __libc_start_main ./csu/../csu/libc-start.c:347:5
#74 0x00005bda66b81b95 _start (/opt/llvm-20/bin/clang-20+0xeb95)
clang: error: clang frontend command failed with exit code 134 (use -v to see invocation)
clang version 20.1.0-rc1 ([email protected]:llvm/llvm-project.git d185bd94ff7717429fd2fffbcd0d4c7c64c05f0b)
Target: mips64-unknown-linux-muslabi64
Thread model: posix
InstalledDir: /opt/llvm-20/bin
Build config: +assertions
clang: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/crypt_des-f90154.c
clang: note: diagnostic msg: /tmp/crypt_des-f90154.sh
clang: note: diagnostic msg:

********************
make: *** [Makefile:159: obj/src/crypt/crypt_des.lo] Error 1
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Feb 5, 2025
@llvmbot
Copy link
Member

llvmbot commented Feb 5, 2025

@llvm/issue-subscribers-backend-mips

Author: Alex Rønne Petersen (alexrp)

To repro:
$ git clone https://git.musl-libc.org/git/musl
$ cd musl
$ make distclean &amp;&amp; \
          ./configure --prefix=$(pwd)/build-all/mips64 --target=mips64-linux-muslabi64 --disable-static AR="llvm-ar" CC="clang --target=mips64-linux-muslabi64" RANLIB="llvm-ranlib" &amp;&amp; \
          make -j$(nproc)
clang --target=mips64-linux-muslabi64 -std=c99 -nostdinc -ffreestanding -fexcess-precision=standard -frounding-math -fno-strict-aliasing -Wa,--noexecstack -D_XOPEN_SOURCE=700 -I./arch/mips64 -I./arch/generic -Iobj/src/internal -I./src/include -I./src/internal -Iobj/include -I./include  -O2 -fno-align-functions -pipe -fomit-frame-pointer -fno-unwind-tables -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections -w -Wno-pointer-to-int-cast -Werror=implicit-function-declaration -Werror=implicit-int -Werror=pointer-sign -Werror=pointer-arith -Werror=int-conversion -Werror=incompatible-pointer-types -Qunused-arguments -Waddress -Warray-bounds -Wchar-subscripts -Wduplicate-decl-specifier -Winit-self -Wreturn-type -Wsequence-point -Wstrict-aliasing -Wunused-function -Wunused-label -Wunused-variable  -fPIC -c -o obj/src/crypt/crypt_des.lo src/crypt/crypt_des.c
clang: /home/alexrp/Source/llvm-project/llvm/include/llvm/ADT/APInt.h:127: llvm::APInt::APInt(unsigned int, uint64_t, bool, bool): Assertion `llvm::isUIntN(BitWidth, val) &amp;&amp; "Value is not an N-bit unsigned value"' failed.
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 --target=mips64-linux-muslabi64 -std=c99 -nostdinc -ffreestanding -fexcess-precision=standard -frounding-math -fno-strict-aliasing -Wa,--noexecstack -D_XOPEN_SOURCE=700 -I./arch/mips64 -I./arch/generic -Iobj/src/internal -I./src/include -I./src/internal -Iobj/include -I./include -O2 -fno-align-functions -pipe -fomit-frame-pointer -fno-unwind-tables -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections -w -Wno-pointer-to-int-cast -Werror=implicit-function-declaration -Werror=implicit-int -Werror=pointer-sign -Werror=pointer-arith -Werror=int-conversion -Werror=incompatible-pointer-types -Qunused-arguments -Waddress -Warray-bounds -Wchar-subscripts -Wduplicate-decl-specifier -Winit-self -Wreturn-type -Wsequence-point -Wstrict-aliasing -Wunused-function -Wunused-label -Wunused-variable -fPIC -c -o obj/src/crypt/crypt_des.lo src/crypt/crypt_des.c
1.      &lt;eof&gt; parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'src/crypt/crypt_des.c'.
4.      Running pass 'MIPS DAG-&gt;DAG Pattern Instruction Selection' on function '@<!-- -->_crypt_extended_r_uut'
 #<!-- -->0 0x0000758457b7ed12 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) /home/alexrp/Source/llvm-project/llvm/lib/Support/Unix/Signals.inc:802:3
 #<!-- -->1 0x0000758457b7c6bf llvm::sys::RunSignalHandlers() /home/alexrp/Source/llvm-project/llvm/lib/Support/Signals.cpp:105:20
 #<!-- -->2 0x0000758457a82710 HandleCrash /home/alexrp/Source/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:73:5
 #<!-- -->3 0x0000758457a82710 CrashRecoverySignalHandler(int) /home/alexrp/Source/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:390:62
 #<!-- -->4 0x0000758456445320 (/lib/x86_64-linux-gnu/libc.so.6+0x45320)
 #<!-- -->5 0x000075845649eb1c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #<!-- -->6 0x000075845649eb1c __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #<!-- -->7 0x000075845649eb1c pthread_kill ./nptl/pthread_kill.c:89:10
 #<!-- -->8 0x000075845644526e raise ./signal/../sysdeps/posix/raise.c:27:6
 #<!-- -->9 0x00007584564288ff abort ./stdlib/abort.c:81:7
#<!-- -->10 0x000075845642881b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#<!-- -->11 0x000075845643b507 (/lib/x86_64-linux-gnu/libc.so.6+0x3b507)
#<!-- -->12 0x0000758457a1fef9 llvm::maxIntN(long) /home/alexrp/Source/llvm-project/llvm/include/llvm/Support/MathExtras.h:252:35
#<!-- -->13 0x0000758457a1fef9 llvm::isIntN(unsigned int, long) /home/alexrp/Source/llvm-project/llvm/include/llvm/Support/MathExtras.h:262:53
#<!-- -->14 0x0000758457a1fef9 llvm::APInt::APInt(unsigned int, unsigned long, bool, bool) /home/alexrp/Source/llvm-project/llvm/include/llvm/ADT/APInt.h:120:11
#<!-- -->15 0x000075845877d0b6 llvm::SelectionDAG::getConstant(llvm::APInt const&amp;, llvm::SDLoc const&amp;, llvm::EVT, bool, bool) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1674:39
#<!-- -->16 0x000075845877d0b6 llvm::SelectionDAG::getConstant(unsigned long, llvm::SDLoc const&amp;, llvm::EVT, bool, bool) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1668:21
#<!-- -->17 0x000075845b83ed37 performORCombine /home/alexrp/Source/llvm-project/llvm/lib/Target/Mips/MipsISelLowering.cpp:1007:32
#<!-- -->18 0x000075845b83ed37 llvm::MipsTargetLowering::PerformDAGCombine(llvm::SDNode*, llvm::TargetLowering::DAGCombinerInfo&amp;) const /home/alexrp/Source/llvm-project/llvm/lib/Target/Mips/MipsISelLowering.cpp:1231:28
#<!-- -->19 0x0000758458590936 combine /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:2039:10
#<!-- -->20 0x0000758458590936 (anonymous namespace)::DAGCombiner::combine(llvm::SDNode*) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:2019:9
#<!-- -->21 0x00007584585923f4 Run /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1798:5
#<!-- -->22 0x00007584585923f4 llvm::SelectionDAG::Combine(llvm::CombineLevel, llvm::BatchAAResults*, llvm::CodeGenOptLevel) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:29246:44
#<!-- -->23 0x00007584587b98cd llvm::TimeRegion::~TimeRegion() /home/alexrp/Source/llvm-project/llvm/include/llvm/Support/Timer.h:160:9
#<!-- -->24 0x00007584587b98cd llvm::NamedRegionTimer::~NamedRegionTimer() /home/alexrp/Source/llvm-project/llvm/include/llvm/Support/Timer.h:168:8
#<!-- -->25 0x00007584587b98cd llvm::SelectionDAGISel::CodeGenAndEmitDAG() /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1099:3
#<!-- -->26 0x00007584587bdef5 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&amp;) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1904:33
#<!-- -->27 0x00007584587bf5b9 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&amp;) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:616:22
#<!-- -->28 0x000075845b837f2e llvm::MipsDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&amp;) /home/alexrp/Source/llvm-project/llvm/lib/Target/Mips/MipsISelDAGToDAG.cpp:53:27
#<!-- -->29 0x00007584587afee7 llvm::OptLevelChanger::~OptLevelChanger() /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:269:11
#<!-- -->30 0x00007584587afee7 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&amp;) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:376:1
#<!-- -->31 0x00007584587afee7 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&amp;) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:347:6
#<!-- -->32 0x00007584580f83bf llvm::MachineFunctionPass::runOnFunction(llvm::Function&amp;) (.part.0) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:94:33
#<!-- -->33 0x0000758457d43324 llvm::FPPassManager::runOnFunction(llvm::Function&amp;) /home/alexrp/Source/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1416:7
#<!-- -->34 0x0000758457d43541 llvm::ilist_detail::node_base_prevnext&lt;llvm::ilist_node_base&lt;true, void&gt;, true&gt;::getNext() const /home/alexrp/Source/llvm-project/llvm/include/llvm/ADT/ilist_node_base.h:42:38
#<!-- -->35 0x0000758457d43541 llvm::ilist_node_impl&lt;llvm::ilist_detail::node_options&lt;llvm::Function, true, false, void, false, void&gt;&gt;::getNext() /home/alexrp/Source/llvm-project/llvm/include/llvm/ADT/ilist_node.h:117:66
#<!-- -->36 0x0000758457d43541 llvm::ilist_iterator&lt;llvm::ilist_detail::node_options&lt;llvm::Function, true, false, void, false, void&gt;, false, false&gt;::operator++() /home/alexrp/Source/llvm-project/llvm/include/llvm/ADT/ilist_iterator.h:187:25
#<!-- -->37 0x0000758457d43541 llvm::FPPassManager::runOnModule(llvm::Module&amp;) /home/alexrp/Source/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1451:22
#<!-- -->38 0x0000758457d43d8d runOnModule /home/alexrp/Source/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1528:7
#<!-- -->39 0x0000758457d43d8d llvm::legacy::PassManagerImpl::run(llvm::Module&amp;) /home/alexrp/Source/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:539:55
#<!-- -->40 0x00007584638752e4 RunCodegenPipeline /home/alexrp/Source/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1229:9
#<!-- -->41 0x00007584638752e4 emitAssembly /home/alexrp/Source/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1252:21
#<!-- -->42 0x00007584638752e4 clang::emitBackendOutput(clang::CompilerInstance&amp;, clang::CodeGenOptions&amp;, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr&lt;llvm::vfs::FileSystem&gt;, std::unique_ptr&lt;llvm::raw_pwrite_stream, std::default_delete&lt;llvm::raw_pwrite_stream&gt;&gt;, clang::BackendConsumer*) /home/alexrp/Source/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1416:25
#<!-- -->43 0x0000758463d7075a llvm::IntrusiveRefCntPtr&lt;llvm::vfs::FileSystem&gt;::release() /home/alexrp/Source/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:232:9
#<!-- -->44 0x0000758463d7075a llvm::IntrusiveRefCntPtr&lt;llvm::vfs::FileSystem&gt;::~IntrusiveRefCntPtr() /home/alexrp/Source/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:196:34
#<!-- -->45 0x0000758463d7075a clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&amp;) /home/alexrp/Source/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:315:20
#<!-- -->46 0x00007584622cd15c clang::ParseAST(clang::Sema&amp;, bool, bool) /home/alexrp/Source/llvm-project/clang/lib/Parse/ParseAST.cpp:184:34
#<!-- -->47 0x0000758464873b87 clang::FrontendAction::Execute() /home/alexrp/Source/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1076:38
#<!-- -->48 0x0000758464803f92 llvm::Error::getPtr() const /home/alexrp/Source/llvm-project/llvm/include/llvm/Support/Error.h:279:51
#<!-- -->49 0x0000758464803f92 llvm::Error::operator bool() /home/alexrp/Source/llvm-project/llvm/include/llvm/Support/Error.h:242:22
#<!-- -->50 0x0000758464803f92 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&amp;) /home/alexrp/Source/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:1056:42
#<!-- -->51 0x000075846490a477 std::__shared_ptr&lt;clang::FrontendOptions, (__gnu_cxx::_Lock_policy)2&gt;::get() const /usr/include/c++/13/bits/shared_ptr_base.h:1666:16
#<!-- -->52 0x000075846490a477 std::__shared_ptr_access&lt;clang::FrontendOptions, (__gnu_cxx::_Lock_policy)2, false, false&gt;::_M_get() const /usr/include/c++/13/bits/shared_ptr_base.h:1363:69
#<!-- -->53 0x000075846490a477 std::__shared_ptr_access&lt;clang::FrontendOptions, (__gnu_cxx::_Lock_policy)2, false, false&gt;::operator*() const /usr/include/c++/13/bits/shared_ptr_base.h:1349:2
#<!-- -->54 0x000075846490a477 clang::CompilerInvocation::getFrontendOpts() /home/alexrp/Source/llvm-project/clang/include/clang/Frontend/CompilerInvocation.h:259:48
#<!-- -->55 0x000075846490a477 clang::CompilerInstance::getFrontendOpts() /home/alexrp/Source/llvm-project/clang/include/clang/Frontend/CompilerInstance.h:313:39
#<!-- -->56 0x000075846490a477 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /home/alexrp/Source/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:297:29
#<!-- -->57 0x00005bda66b8a1ec cc1_main(llvm::ArrayRef&lt;char const*&gt;, char const*, void*) /home/alexrp/Source/llvm-project/clang/tools/driver/cc1_main.cpp:290:40
#<!-- -->58 0x00005bda66b824d9 ExecuteCC1Tool(llvm::SmallVectorImpl&lt;char const*&gt;&amp;, llvm::ToolContext const&amp;) /home/alexrp/Source/llvm-project/clang/tools/driver/driver.cpp:218:20
#<!-- -->59 0x00007584643f5e8d operator() /home/alexrp/Source/llvm-project/clang/lib/Driver/Job.cpp:437:32
#<!-- -->60 0x00007584643f5e8d void llvm::function_ref&lt;void ()&gt;::callback_fn&lt;clang::driver::CC1Command::Execute(llvm::ArrayRef&lt;std::optional&lt;llvm::StringRef&gt;&gt;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt;&gt;*, bool*) const::'lambda'()&gt;(long) /home/alexrp/Source/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:46:52
#<!-- -->61 0x0000758457a8289e llvm::CrashRecoveryContext::RunSafely(llvm::function_ref&lt;void ()&gt;) /home/alexrp/Source/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:427:10
#<!-- -->62 0x00007584643f6eff clang::driver::CC1Command::Execute(llvm::ArrayRef&lt;std::optional&lt;llvm::StringRef&gt;&gt;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt;&gt;*, bool*) const (.part.0) /home/alexrp/Source/llvm-project/clang/lib/Driver/Job.cpp:441:10
#<!-- -->63 0x00007584643b6f2b clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&amp;, clang::driver::Command const*&amp;, bool) const /home/alexrp/Source/llvm-project/clang/lib/Driver/Compilation.cpp:197:3
#<!-- -->64 0x00007584643b73c6 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&amp;, llvm::SmallVectorImpl&lt;std::pair&lt;int, clang::driver::Command const*&gt;&gt;&amp;, bool) const /home/alexrp/Source/llvm-project/clang/lib/Driver/Compilation.cpp:251:5
#<!-- -->65 0x00007584643c9c54 llvm::SmallVectorBase&lt;unsigned int&gt;::empty() const /home/alexrp/Source/llvm-project/llvm/include/llvm/ADT/SmallVector.h:81:46
#<!-- -->66 0x00007584643c9c54 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&amp;, llvm::SmallVectorImpl&lt;std::pair&lt;int, clang::driver::Command const*&gt;&gt;&amp;) /home/alexrp/Source/llvm-project/clang/lib/Driver/Driver.cpp:2190:28
#<!-- -->67 0x00005bda66b85cd2 llvm::SmallVectorBase&lt;unsigned int&gt;::size() const /home/alexrp/Source/llvm-project/llvm/include/llvm/ADT/SmallVector.h:78:32
#<!-- -->68 0x00005bda66b85cd2 llvm::SmallVectorTemplateCommon&lt;std::pair&lt;int, clang::driver::Command const*&gt;, void&gt;::end() /home/alexrp/Source/llvm-project/llvm/include/llvm/ADT/SmallVector.h:269:41
#<!-- -->69 0x00005bda66b85cd2 clang_main(int, char**, llvm::ToolContext const&amp;) /home/alexrp/Source/llvm-project/clang/tools/driver/driver.cpp:400:26
#<!-- -->70 0x00005bda66b81b3a main /home/alexrp/Source/llvm-project/build-20/tools/clang/tools/driver/clang-driver.cpp:18:1
#<!-- -->71 0x000075845642a1ca __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#<!-- -->72 0x000075845642a28b call_init ./csu/../csu/libc-start.c:128:20
#<!-- -->73 0x000075845642a28b __libc_start_main ./csu/../csu/libc-start.c:347:5
#<!-- -->74 0x00005bda66b81b95 _start (/opt/llvm-20/bin/clang-20+0xeb95)
clang: error: clang frontend command failed with exit code 134 (use -v to see invocation)
clang version 20.1.0-rc1 (git@<!-- -->github.com:llvm/llvm-project.git d185bd94ff7717429fd2fffbcd0d4c7c64c05f0b)
Target: mips64-unknown-linux-muslabi64
Thread model: posix
InstalledDir: /opt/llvm-20/bin
Build config: +assertions
clang: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/crypt_des-f90154.c
clang: note: diagnostic msg: /tmp/crypt_des-f90154.sh
clang: note: diagnostic msg:

********************
make: *** [Makefile:159: obj/src/crypt/crypt_des.lo] Error 1

@nikic
Copy link
Contributor

nikic commented Feb 5, 2025

Can you please attach the generated reproducer files?

@alexrp
Copy link
Member Author

alexrp commented Feb 5, 2025

@alexrp alexrp added llvm Umbrella label for LLVM issues and removed clang Clang issues not falling into any other category labels Feb 5, 2025
@topperc
Copy link
Collaborator

topperc commented Feb 5, 2025

From a quick glance at the code this might fix it

diff --git a/llvm/lib/Target/Mips/MipsISelLowering.cpp b/llvm/lib/Target/Mips/MipsISelLowering.cpp
index 099a3f7dbc65..afec52e289e2 100644
--- a/llvm/lib/Target/Mips/MipsISelLowering.cpp
+++ b/llvm/lib/Target/Mips/MipsISelLowering.cpp
@@ -1004,7 +1004,7 @@ static SDValue performORCombine(SDNode *N, SelectionDAG &DAG,
       return DAG.getNode(
           MipsISD::Ins, DL, N->getValueType(0),
           isConstCase
-              ? DAG.getConstant(CN1->getSExtValue() >> SMPos0, DL, ValTy)
+              ? DAG.getSignedConstant(CN1->getSExtValue() >> SMPos0, DL, ValTy)
               : SrlX,
           DAG.getConstant(SMPos0, DL, MVT::i32),
           DAG.getConstant(ValTy.getSizeInBits() / 8 < 8 ? SMSize0 & 31

@EugeneZelenko EugeneZelenko added llvm:SelectionDAG SelectionDAGISel as well and removed llvm Umbrella label for LLVM issues labels Feb 5, 2025
@nikic nikic self-assigned this Feb 6, 2025
@nikic
Copy link
Contributor

nikic commented Feb 6, 2025

Reduced:

target triple = "mips64-unknown-linux-muslabi64"
  
define i32 @test(i32 %arg, i1 %c) #0 {
  %and = and i32 %arg, 255
  %or = or i32 %and, -256
  %sel = select i1 %c, i32 %or, i32 %and
  ret i32 %sel 
} 
  
attributes #0 = { "target-cpu"="mips64r2" }

@nikic nikic closed this as completed in 88b1d16 Feb 6, 2025
@github-project-automation github-project-automation bot moved this from Needs Triage to Done in LLVM Release Status Feb 6, 2025
@nikic
Copy link
Contributor

nikic commented Feb 6, 2025

/cherry-pick 88b1d16

@llvmbot
Copy link
Member

llvmbot commented Feb 6, 2025

/pull-request #126083

@EugeneZelenko EugeneZelenko added release:backport and removed llvm:SelectionDAG SelectionDAGISel as well labels Feb 6, 2025
github-actions bot pushed a commit to arm/arm-toolchain that referenced this issue Feb 6, 2025
github-actions bot pushed a commit to arm/arm-toolchain that referenced this issue Feb 8, 2025
Icohedron pushed a commit to Icohedron/llvm-project that referenced this issue Feb 11, 2025
clayne pushed a commit to clayne/llvm-project that referenced this issue Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

5 participants