llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.01k stars 11.56k forks source link

Compiler asked me to submit the crash report. #70433

Closed aphidspider closed 9 months ago

aphidspider commented 10 months ago

Hi, I have attached the files from a) /tmp directory b) my source code c) my make file. and below is the output of make command on stderr

[yet_another_ebpf_smpp]# make
clang \
    -target bpf \
    -D __BPF_TRACING__ \
        -I/usr/include/x86_64-linux-gnu \
    -Wall -g  \
    -O2 -o smpp.bpf.o -c smpp.bpf.c
Error at line 37: Unsupport signed division for DAG: 0x11bb978: i64 = sdiv exact 0x11bb8a8, Constant:i64<52>, ./packet.h:37:3Please convert to unsigned div/mod.
fatal error: error in backend: Cannot select: 0x11bb978: i64 = sdiv exact 0x11bb8a8, Constant:i64<52>, ./packet.h:37:3
  0x11bb8a8: i64 = sub nsw 0x11baf50, 0x11bb500, ./packet.h:37:3
    0x11baf50: i64,ch = load<(load (s32) from %ir.13, !tbaa !165), zext from i32> 0x1160128, 0x11bb360, undef:i64, ./packet.h:34:39
      0x11bb360: i64 = add 0x11bae18, 0x11bb2f8
        0x11bae18: i64,ch = CopyFromReg 0x1160128, Register:i64 %0
          0x11badb0: i64 = Register %0
        0x11bb2f8: i64,ch = load<(dereferenceable load (s64) from @"llvm.xdp_md:0:4$0:1")> 0x1160128, 0x11bb430, undef:i64
          0x11bb430: i64 = BPFISD::Wrapper TargetGlobalAddress:i64<i64* @"llvm.xdp_md:0:4$0:1"> 0
            0x11bbd20: i64 = TargetGlobalAddress<i64* @"llvm.xdp_md:0:4$0:1"> 0
          0x11bb088: i64 = undef
      0x11bb088: i64 = undef
    0x11bb500: i64 = add 0x11bb3c8, 0xe79958, ./packet.h:36:59
      0x11bb3c8: i64,ch = load<(load (s32) from %ir.7, !tbaa !157), zext from i32> 0x1160128, 0x11bb158, undef:i64, ./packet.h:33:37
        0x11bb158: i64 = add 0x11bae18, 0x11bb0f0
          0x11bae18: i64,ch = CopyFromReg 0x1160128, Register:i64 %0
            0x11badb0: i64 = Register %0
          0x11bb0f0: i64,ch = load<(dereferenceable load (s64) from @"llvm.xdp_md:0:0$0:0")> 0x1160128, 0x11bb498, undef:i64
            0x11bb498: i64 = BPFISD::Wrapper TargetGlobalAddress:i64<i64* @"llvm.xdp_md:0:0$0:0"> 0
              0x11bb290: i64 = TargetGlobalAddress<i64* @"llvm.xdp_md:0:0$0:0"> 0
            0x11bb088: i64 = undef
        0x11bb088: i64 = undef
      0xe79958: i64 = and 0x11baee8, Constant:i64<4294967295>, ./packet.h:36:59
        0x11baee8: i64,ch = CopyFromReg 0x1160128, Register:i64 %1
          0x11bae80: i64 = Register %1
        0x11bbc50: i64 = Constant<4294967295>
  0x11bb910: i64 = Constant<52>
In function: parse_smpp
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 bpf -D __BPF_TRACING__ -I/usr/include/x86_64-linux-gnu -Wall -g -O2 -o smpp.bpf.o -c smpp.bpf.c
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'smpp.bpf.c'.
4.      Running pass 'BPF DAG->DAG Pattern Instruction Selection' on function '@parse_smpp'
 #0 0x00007fd4b343fd01 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xe3fd01)
 #1 0x00007fd4b343da3e llvm::sys::RunSignalHandlers() (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xe3da3e)
 #2 0x00007fd4b343f0ab llvm::sys::CleanupOnSignal(unsigned long) (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xe3f0ab)
 #3 0x00007fd4b336bbea (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xd6bbea)
 #4 0x00007fd4b336bb8b (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xd6bb8b)
 #5 0x00007fd4b343a007 llvm::sys::Process::Exit(int, bool) (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xe3a007)
 #6 0x00000000004136d2 (/usr/lib/llvm-14/bin/clang+0x4136d2)
 #7 0x00007fd4b337a673 llvm::report_fatal_error(llvm::Twine const&, bool) (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xd7a673)
 #8 0x00007fd4b3c60e31 (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0x1660e31)
 #9 0x00007fd4b3c602d8 llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0x16602d8)
#10 0x00007fd4b55650bd (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0x2f650bd)
#11 0x00007fd4b3c58ecf llvm::SelectionDAGISel::DoInstructionSelection() (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0x1658ecf)
#12 0x00007fd4b3c58594 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0x1658594)
#13 0x00007fd4b3c579c8 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0x16579c8)
#14 0x00007fd4b3c55557 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0x1655557)
#15 0x00007fd4b37c628e llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0x11c628e)
#16 0x00007fd4b357a390 llvm::FPPassManager::runOnFunction(llvm::Function&) (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xf7a390)
#17 0x00007fd4b3581983 llvm::FPPassManager::runOnModule(llvm::Module&) (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xf81983)
#18 0x00007fd4b357af36 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xf7af36)
#19 0x00007fd4ba857201 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1857201)
#20 0x00007fd4bab7c855 (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1b7c855)
#21 0x00007fd4b9a04824 clang::ParseAST(clang::Sema&, bool, bool) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0xa04824)
#22 0x00007fd4bab78b71 clang::CodeGenAction::ExecuteAction() (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1b78b71)
#23 0x00007fd4bb514b57 clang::FrontendAction::Execute() (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x2514b57)
#24 0x00007fd4bb46c3a6 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x246c3a6)
#25 0x00007fd4bb58e45b clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x258e45b)
#26 0x000000000041328b cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/lib/llvm-14/bin/clang+0x41328b)
#27 0x00000000004114bc (/usr/lib/llvm-14/bin/clang+0x4114bc)
#28 0x00007fd4bb0eaed2 (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x20eaed2)
#29 0x00007fd4b336bb6d llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xd6bb6d)
#30 0x00007fd4bb0ea9c0 clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x20ea9c0)
#31 0x00007fd4bb0b5183 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x20b5183)
#32 0x00007fd4bb0b540a clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x20b540a)
#33 0x00007fd4bb0cf507 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x20cf507)
#34 0x0000000000410f26 main (/usr/lib/llvm-14/bin/clang+0x410f26)
#35 0x00007fd4b1e29d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#36 0x00007fd4b1e29e40 call_init ./csu/../csu/libc-start.c:128:20
#37 0x00007fd4b1e29e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#38 0x000000000040e3b5 _start (/usr/lib/llvm-14/bin/clang+0x40e3b5)
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
Ubuntu clang version 14.0.0-1ubuntu1.1
Target: bpf
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/smpp-0356a3.c
clang: note: diagnostic msg: /tmp/smpp-0356a3.sh
clang: note: diagnostic msg:

********************
make: *** [Makefile:17: smpp.bpf.o] Error 70
[yet_another_ebpf_smpp]# pwd
/home/rajeev/workspace/ebpf/learning-ebpf/yet_another_ebpf_smpp
[yet_another_ebpf_smpp]#
DimitryAndric commented 10 months ago

I have attached the files from

Did you actually attach them? There are no files visible in this issue.

aphidspider commented 10 months ago

Uploaded on the site (drag and drop). I have attached again.

Rajeev Sharma Senior Software Engineer [cid:alllogos-03_db8eea23-8e0d-4513-9db0-05e9779e9511.png] [cid:phone2_59a8a2cb-4fad-4e7b-8d5a-14c6c1d3d077.png] 080-48658858 [cid:mobile2_5994f3f8-eddf-4fcd-806c-d04085bbbe90.png] 9441349416 [cid:email2_6348f084-5441-48e2-a7cc-883c642a5e83.png] @.**@.> [cid:website2_98645d4f-3d86-4ed6-a249-3feefb1a56a3.png] www.montymobile.comhttps://www.montymobile.com

[cid:face_42e13b7b-62c9-4569-adc0-d7dc34592532.png]https://www.facebook.com/MontyMobile [cid:linked_285ed601-5dee-4220-8b84-53b34c12e50a.png] https://www.linkedin.com/company/monty-mobile/ [cid:twit_1685e628-c80b-4d4d-ba72-96a213444dbe.png] https://twitter.com/monty_mobile_ [cid:you_6dfbccd5-3f62-4f42-ad07-794c4350fc49.png] https://www.youtube.com/user/MontyMobileHub [cid:insta_73c2b5b7-d010-4d11-9ba2-1d650fef2796.png] https://www.instagram.com/montymobile/ For your complaints kindly do not hesitate to contact the management at: @.**@.> [cid:tree_9cad548c-6957-43de-88ca-f60753dbaaf3.png] Please consider the environment before printing this email

From: Dimitry Andric @.> Sent: Friday, October 27, 2023 3:03 PM To: llvm/llvm-project @.> Cc: Rajeev Sharma @.>; Author @.> Subject: Re: [llvm/llvm-project] Compiler asked me to submit the crash report. (Issue #70433)

I have attached the files from

Did you actually attach them? There are no files visible in this issue.

— Reply to this email directly, view it on GitHubhttps://github.com/llvm/llvm-project/issues/70433#issuecomment-1782601633, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AHSJVX6HLZNCFBE43BD2GY3YBN5TNAVCNFSM6AAAAAA6SP6FJKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBSGYYDCNRTGM. You are receiving this because you authored the thread.Message ID: @.**@.>>

inclyc commented 9 months ago

Signed division, sdiv is introduced recently and not enabled by default, please use -mcpu=v4 to enable this.

https://lore.kernel.org/bpf/4bfe98be-5333-1c7e-2f6d-42486c8ec039@meta.com/ https://godbolt.org/z/1nPMExqxf https://godbolt.org/z/fbqYjW8ze