[llvm-bugs] [Bug 52399] New: LLC crash caused by the naked function attribute

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Nov 3 23:45:45 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=52399

            Bug ID: 52399
           Summary: LLC crash caused by the naked function attribute
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: b2.temp at gmx.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

## IR

---
; ModuleID = '<stdin>'
source_filename = "r"

; Function Attrs: noinline
define i32 @r.slow(i32 %0, i32 %1, i32 %2) #0 {
entry:
  %3 = alloca [2 x i32], align 4
  %4 = getelementptr [2 x i32], [2 x i32]* %3, i32 0, i32 0
  store i32 %1, i32* %4, align 4
  %5 = getelementptr [2 x i32], [2 x i32]* %3, i32 0, i32 1
  store i32 %2, i32* %5, align 4
  %6 = load [2 x i32], [2 x i32]* %3, align 4
  store [2 x i32] %6, [2 x i32]* %3, align 4
  %7 = getelementptr [2 x i32], [2 x i32]* %3, i32 0, i32 0
  %8 = and i32 %0, 1
  %9 = getelementptr i32, i32* %7, i32 %8
  %10 = load i32, i32* %9, align 4
  ret i32 %10
}

attributes #0 = { naked }
---

## backtrace

---
Output of llc (trunk) (Compiler #1)
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace.
Stack dump:
0.      Program arguments: /opt/compiler-explorer/clang-trunk/bin/llc -o
/app/output.s -x86-asm-syntax=intel <source>
1.      Running pass 'Function Pass Manager' on module '<source>'.
2.      Running pass 'X86 DAG->DAG Instruction Selection' on function '@r.slow'
 #0 0x00005647c8cf429f PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
 #1 0x00005647c8cf1b4d SignalHandler(int) Signals.cpp:0:0
 #2 0x00007fd5a77ce3c0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
 #3 0x00005647c6c71710 isBitfieldExtractOp(llvm::SelectionDAG*, llvm::SDNode*,
unsigned int&, llvm::SDValue&, unsigned int&, unsigned int&, unsigned int,
bool) (.part.271) AArch64ISelDAGToDAG.cpp:0:0
 #4 0x00005647c8b3debe
llvm::TargetLowering::SimplifyDemandedBits(llvm::SDValue, llvm::APInt const&,
llvm::APInt const&, llvm::KnownBits&, llvm::TargetLowering::TargetLoweringOpt&,
unsigned int, bool) const
(/opt/compiler-explorer/clang-trunk/bin/llc+0x293debe)
 #5 0x00005647c8b40b99
llvm::TargetLowering::SimplifyDemandedBits(llvm::SDValue, llvm::APInt const&,
llvm::APInt const&, llvm::KnownBits&, llvm::TargetLowering::TargetLoweringOpt&,
unsigned int, bool) const
(/opt/compiler-explorer/clang-trunk/bin/llc+0x2940b99)
 #6 0x00005647c8b42118
llvm::TargetLowering::SimplifyDemandedBits(llvm::SDValue, llvm::APInt const&,
llvm::APInt const&, llvm::KnownBits&, llvm::TargetLowering::TargetLoweringOpt&,
unsigned int, bool) const
(/opt/compiler-explorer/clang-trunk/bin/llc+0x2942118)
 #7 0x00005647c8b4603f
llvm::TargetLowering::SimplifyDemandedBits(llvm::SDValue, llvm::APInt const&,
llvm::KnownBits&, llvm::TargetLowering::TargetLoweringOpt&, unsigned int, bool)
const (/opt/compiler-explorer/clang-trunk/bin/llc+0x294603f)
 #8 0x00005647c89ec769 (anonymous
namespace)::DAGCombiner::SimplifyDemandedBits(llvm::SDValue) (.constprop.1056)
DAGCombiner.cpp:0:0
 #9 0x00005647c89f9a66 (anonymous
namespace)::DAGCombiner::visitADDLike(llvm::SDNode*) DAGCombiner.cpp:0:0
#10 0x00005647c89fabb5 (anonymous
namespace)::DAGCombiner::visitADD(llvm::SDNode*) DAGCombiner.cpp:0:0
#11 0x00005647c8a21c9c (anonymous namespace)::DAGCombiner::visit(llvm::SDNode*)
DAGCombiner.cpp:0:0
#12 0x00005647c8a235bd (anonymous
namespace)::DAGCombiner::combine(llvm::SDNode*) DAGCombiner.cpp:0:0
#13 0x00005647c8a24e9c llvm::SelectionDAG::Combine(llvm::CombineLevel,
llvm::AAResults*, llvm::CodeGenOpt::Level)
(/opt/compiler-explorer/clang-trunk/bin/llc+0x2824e9c)
#14 0x00005647c8b1d60f llvm::SelectionDAGISel::CodeGenAndEmitDAG()
(/opt/compiler-explorer/clang-trunk/bin/llc+0x291d60f)
#15 0x00005647c8b20d64
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
(/opt/compiler-explorer/clang-trunk/bin/llc+0x2920d64)
#16 0x00005647c8b22ff2
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(.part.885) SelectionDAGISel.cpp:0:0
#17 0x00005647c78ad3f0 (anonymous
namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&)
X86ISelDAGToDAG.cpp:0:0
#18 0x00005647c8136208
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/opt/compiler-explorer/clang-trunk/bin/llc+0x1f36208)
#19 0x00005647c85679d9 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/opt/compiler-explorer/clang-trunk/bin/llc+0x23679d9)
#20 0x00005647c8567c71 llvm::FPPassManager::runOnModule(llvm::Module&)
(/opt/compiler-explorer/clang-trunk/bin/llc+0x2367c71)
#21 0x00005647c8568ee7 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/opt/compiler-explorer/clang-trunk/bin/llc+0x2368ee7)
#22 0x00005647c6aa71c1 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#23 0x00005647c69d5e5e main
(/opt/compiler-explorer/clang-trunk/bin/llc+0x7d5e5e)
#24 0x00007fd5a727e0b3 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x270b3)
#25 0x00005647c6a9edfa _start
(/opt/compiler-explorer/clang-trunk/bin/llc+0x89edfa)
Compiler returned: 139
---

## notes

while the naked attribute is missused, (since there's an alloca), llc should
not crash

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211104/ef4849a9/attachment.html>


More information about the llvm-bugs mailing list