Issue 98880
Summary clang/llvm 18.1.8 ( Arch Linux ) crash when compiling linux using march set to znver4
Labels clang
Assignees
Reporter sinatosk
    I've been compiling Linux using clang/llvm for sometime ( 1-2 years ).

Since Arch Linux updated llvm to 18.1.8 recently ( 7th July 2024 ), clang/llvm crashes when using "march=znver4" when compiling Linux 6.9 and 6.10

> net/ipv6/ip6_input.c

from the Linux source tree

The error I'm seeing is ( from Linux 6.10, it's the same for Linux 6.9 )

```
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_vector.h:1130: reference std::vector<llvm::SUnit>::operator[](size_type) [_Tp = llvm::SUnit, _Alloc = std::allocator<llvm::SUnit>]: Assertion '__n < this->size()' 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: /usr/bin/clang --target=x86_64-linux-gnu -fintegrated-as -Werror=unknown-warning-option -Werror=ignored-optimization-argument -Werror=option-ignored -Werror=unused-command-line-argument -fmacro-prefix-map=./= -std=gnu11 -fshort-wchar -funsigned-char -fno-common -fno-PIE -fno-strict-aliasing -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-protection=branch -fno-jump-tables -m64 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mstack-alignment=8 -mskip-rax-setup -march=znver4 -mno-red-zone -mcmodel=kernel -Wno-sign-compare -fno-asynchronous-unwind-tables -mretpoline-external-thunk -mindirect-branch-cs-prefix -mfunction-return=thunk-extern -mharden-sls=all -fpatchable-function-entry=16,16 -fno-delete-null-pointer-checks -O2 -fstack-protector-strong -ftrivial-auto-var-init=zero -fno-stack-clash-protection -fzero-call-used-regs=used-gpr -pg -mfentry -falign-functions=16 -fstrict-flex-arrays=3 -fno-strict-overflow -fno-stack-check -Wall -Wundef -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Werror=strict-prototypes -Wno-format-security -Wno-trigraphs -Wno-frame-address -Wno-address-of-packed-member -Wmissing-declarations -Wmissing-prototypes -Wframe-larger-than=2048 -Wno-gnu -Wvla -Wno-pointer-sign -Wcast-function-type -Wimplicit-fallthrough -Werror=date-time -Werror=incompatible-pointer-types -Wenum-conversion -Wextra -Wunused -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-format-overflow -Wno-format-overflow-non-kprintf -Wno-format-truncation-non-kprintf -Wno-override-init -Wno-pointer-to-enum-cast -Wno-tautological-constant-out-of-range-compare -Wno-unaligned-access -Wno-enum-compare-conditional -Wno-enum-enum-conversion -Wno-missing-field-initializers -Wno-type-limits -Wno-shift-negative-value -Wno-sign-compare -Wno-unused-parameter -g -gdwarf-5 -nostdinc -I./arch/x86/include -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -DCC_USING_NOP_MCOUNT -DCC_USING_FENTRY -DKBUILD_MODFILE=\"net/ipv6/ipv6\" -DKBUILD_BASENAME=\"ip6_input\" -DKBUILD_MODNAME=\"ipv6\" -D__KBUILD_MODNAME=kmod_ipv6 -c -Wp,-MMD,net/ipv6/.ip6_input.o.d -fcolor-diagnostics -o net/ipv6/ip6_input.o net/ipv6/ip6_input.c
1. <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'net/ipv6/ip6_input.c'.
4. Running pass 'X86 DAG->DAG Instruction Selection' on function '@ip6_rcv_core'
 #0 0x00007f0db4b2e560 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/libLLVM.so.18.1+0x352e560)
 #1 0x00007f0db4b2bfaf llvm::sys::RunSignalHandlers() (/usr/lib/libLLVM.so.18.1+0x352bfaf)
 #2 0x00007f0db4a5a5ec (/usr/lib/libLLVM.so.18.1+0x345a5ec)
 #3 0x00007f0db1050ae0 (/usr/lib/libc.so.6+0x3cae0)
 #4 0x00007f0db10a8e44 (/usr/lib/libc.so.6+0x94e44)
 #5 0x00007f0db1050a30 raise (/usr/lib/libc.so.6+0x3ca30)
 #6 0x00007f0db10384c3 abort (/usr/lib/libc.so.6+0x244c3)
 #7 0x00007f0db12d2d60 std::chrono::_V2::system_clock::now() /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/chrono.cc:52:5
 #8 0x00007f0db5520618 llvm::ScheduleDAGSDNodes::AddSchedEdges() (/usr/lib/libLLVM.so.18.1+0x3f20618)
 #9 0x00007f0db5514079 (/usr/lib/libLLVM.so.18.1+0x3f14079)
#10 0x00007f0db55db763 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/usr/lib/libLLVM.so.18.1+0x3fdb763)
#11 0x00007f0db55da6d7 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/usr/lib/libLLVM.so.18.1+0x3fda6d7)
#12 0x00007f0db55d8422 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/usr/lib/libLLVM.so.18.1+0x3fd8422)
#13 0x00007f0db815ea09 (/usr/lib/libLLVM.so.18.1+0x6b5ea09)
#14 0x00007f0db500e4c8 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/usr/lib/libLLVM.so.18.1+0x3a0e4c8)
#15 0x00007f0db4cc8e57 llvm::FPPassManager::runOnFunction(llvm::Function&) (/usr/lib/libLLVM.so.18.1+0x36c8e57)
#16 0x00007f0db4cd07c4 llvm::FPPassManager::runOnModule(llvm::Module&) (/usr/lib/libLLVM.so.18.1+0x36d07c4)
#17 0x00007f0db4cc9c1c llvm::legacy::PassManagerImpl::run(llvm::Module&) (/usr/lib/libLLVM.so.18.1+0x36c9c1c)
#18 0x00007f0db9f2f21f 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*) (/usr/lib/libclang-cpp.so.18.1+0x152f21f)
#19 0x00007f0dba2add95 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/usr/lib/libclang-cpp.so.18.1+0x18add95)
#20 0x00007f0db8f89f23 clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib/libclang-cpp.so.18.1+0x589f23)
#21 0x00007f0dbaa1a7c1 clang::FrontendAction::Execute() (/usr/lib/libclang-cpp.so.18.1+0x201a7c1)
#22 0x00007f0dba9bbad7 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib/libclang-cpp.so.18.1+0x1fbbad7)
#23 0x00007f0dbaa6e11d clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib/libclang-cpp.so.18.1+0x206e11d)
#24 0x0000555d9a2e6284 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/bin/clang+0x13284)
#25 0x0000555d9a2ea5ba (/usr/bin/clang+0x175ba)
#26 0x00007f0dba6f7175 (/usr/lib/libclang-cpp.so.18.1+0x1cf7175)
#27 0x00007f0db4a5a326 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/usr/lib/libLLVM.so.18.1+0x345a326)
#28 0x00007f0dba6f9aa6 (/usr/lib/libclang-cpp.so.18.1+0x1cf9aa6)
#29 0x00007f0dba6b5529 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/usr/lib/libclang-cpp.so.18.1+0x1cb5529)
#30 0x00007f0dba6b591c clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/usr/lib/libclang-cpp.so.18.1+0x1cb591c)
#31 0x00007f0dba6d38c4 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/usr/lib/libclang-cpp.so.18.1+0x1cd38c4)
#32 0x0000555d9a2ecebd clang_main(int, char**, llvm::ToolContext const&) (/usr/bin/clang+0x19ebd)
#33 0x0000555d9a2ddfb5 main (/usr/bin/clang+0xafb5)
#34 0x00007f0db1039c88 (/usr/lib/libc.so.6+0x25c88)
#35 0x00007f0db1039d4c __libc_start_main (/usr/lib/libc.so.6+0x25d4c)
#36 0x0000555d9a2de015 _start (/usr/bin/clang+0xb015)
clang: error: clang frontend command failed with exit code 134 (use -v to see invocation)
clang version 18.1.8
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
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/ip6_input-2028c7.c
clang: note: diagnostic msg: /tmp/ip6_input-2028c7.sh
clang: note: diagnostic msg: 

********************
make[4]: *** [scripts/Makefile.build:244: net/ipv6/ip6_input.o] Error 1
make[3]: *** [scripts/Makefile.build:485: net/ipv6] Error 2
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [scripts/Makefile.build:485: net] Error 2
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/home/user/path/to/linux/src/Makefile:1934: .] Error 2
make: *** [Makefile:240: __sub-make] Error 2
```

I've [attached](https://github.com/user-attachments/files/16233042/ip6_input-2028c7.zip) the two files ( ip6_input-2028c7.c and ip6_input-2028c7.sh in a zip file ) mentioned in error log. I've searched and replaced some paths and hostname in the files like

> /path/to/private/key

> /home/user/path/to/linux/src

> hostname

I've compiled Linux 6.10 with march set to x86-64-v4 successfully

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to