<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - case where llc crashes when DWARF are generated"
href="https://bugs.llvm.org/show_bug.cgi?id=52363">52363</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>case where llc crashes when DWARF are generated
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>11.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>b2.temp@gmx.com
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>the test case is reduced from the source language side to produce this ll file:
di_bug.ll:
---
; ModuleID = 'di_bug'
source_filename = "di_bug"
; Function Attrs: noinline
define i32 @main() #0 !dbg !7 {
entry:
call void @di_bug.takeFun(void (i32)* @di_bug.main.27.__tmp0), !dbg !13
ret i32 0, !dbg !14
}
; Function Attrs: noinline
define void @di_bug.takeFun(void (i32)* %0) #0 !dbg !15 {
entry:
%1 = alloca void (i32)*, align 8
store void (i32)* %0, void (i32)** %1, align 8
call void @llvm.dbg.declare(metadata void (i32)** %1, metadata !20, metadata
!DIExpression()), !dbg !21
ret void, !dbg !22
}
; Function Attrs: nounwind readnone speculatable willreturn
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
; Function Attrs: noinline
define void @di_bug.main.27.__tmp0(i32 %0) #0 !dbg !24 {
entry:
%1 = alloca i32, align 4
store i32 %0, i32* %1, align 4
call void @llvm.dbg.declare(metadata i32* %1, metadata !26, metadata
!DIExpression()), !dbg !27
ret void, !dbg !28
}
attributes #0 = { noinline }
attributes #1 = { nounwind readnone speculatable willreturn }
!llvm.module.flags = !{!0, !1}
!llvm.dbg.cu = !{!2}
!0 = !{i32 2, !"Dwarf Version", i32 2}
!1 = !{i32 2, !"Debug Info Version", i32 3}
!2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "0.0.0",
isOptimized: false, runtimeVersion: 0, splitDebugFilename: "temp.txt",
emissionKind: FullDebug, enums: !4, splitDebugInlining: false)
!3 = !DIFile(filename: "di_bug.sx", directory: "/home/xxxx/Desktop/temp")
!4 = !{!5}
!5 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "E", scope: !6, file:
!3, baseType: !10, size: 32, elements: !11)
!6 = distinct !DILexicalBlock(scope: !7, file: !3, line: 11, column: 5)
!7 = distinct !DISubprogram(name: "main", linkageName: "main", scope: !3, file:
!3, line: 8, type: !8, scopeLine: 8, flags: DIFlagPrototyped, spFlags:
DISPFlagLocalToUnit | DISPFlagDefinition, unit: !2, retainedNodes: !9)
!8 = !DISubroutineType(types: !9)
!9 = !{}
!10 = !DIBasicType(name: "u32", size: 32, encoding: DW_ATE_unsigned)
!11 = !{!12}
!12 = !DIEnumerator(name: "e", value: 0)
!13 = !DILocation(line: 11, column: 12, scope: !6)
!14 = !DILocation(line: 12, column: 5, scope: !6)
!15 = distinct !DISubprogram(name: "di_bug.takeFun", linkageName:
"di_bug.takeFun", scope: !3, file: !3, line: 19, type: !16, scopeLine: 19,
flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition,
unit: !2, retainedNodes: !9)
!16 = !DISubroutineType(types: !17)
!17 = !{!18}
!18 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "static function (E e)*",
baseType: !19, size: 64, align: 8, dwarfAddressSpace: 0)
!19 = !DIBasicType(tag: DW_TAG_unspecified_type, name: "static function (E e)")
!20 = !DILocalVariable(name: "afun", arg: 1, scope: !15, file: !3, line: 19,
type: !18)
!21 = !DILocation(line: 19, column: 18, scope: !15)
!22 = !DILocation(line: 21, column: 1, scope: !23)
!23 = distinct !DILexicalBlock(scope: !15, file: !3, line: 21, column: 1)
!24 = distinct !DISubprogram(name: "di_bug.main.27.__tmp0", linkageName:
"di_bug.main.27.__tmp0", scope: !3, file: !3, line: 11, type: !25, scopeLine:
11, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition,
unit: !2, retainedNodes: !9)
!25 = !DISubroutineType(types: !4)
!26 = !DILocalVariable(name: "e", arg: 1, scope: !24, file: !3, line: 11, type:
!5)
!27 = !DILocation(line: 11, column: 24, scope: !24)
!28 = !DILocation(line: 11, column: 34, scope: !29)
!29 = distinct !DILexicalBlock(scope: !24, file: !3, line: 11, column: 34)
---
If i feed LLC with that IR then it crashes
```bash
$ llc di_bug.ll
PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace.
Stack dump:
0. Program arguments: /usr/bin/llc --filetype=obj --relocation-model=pic
--mtriple=x86_64 -O0
#0 0x00007f848223527a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/lib64/libLLVM-11.so+0xa8b27a)
#1 0x00007f84822334e4 llvm::sys::RunSignalHandlers()
(/lib64/libLLVM-11.so+0xa894e4)
#2 0x00007f8482233676 (/lib64/libLLVM-11.so+0xa89676)
#3 0x00007f8481434a70 __restore_rt (/lib64/libc.so.6+0x3da70)
#4 0x00007f84829a7f40 llvm::DIE::getUnitDie() const
(/lib64/libLLVM-11.so+0x11fdf40)
#5 0x00007f84829a7f99 llvm::DIE::getUnit() const
(/lib64/libLLVM-11.so+0x11fdf99)
#6 0x00007f84829e10f7 llvm::DwarfUnit::getOrCreateTypeDIE(llvm::MDNode const*)
(/lib64/libLLVM-11.so+0x12370f7)
#7 0x00007f84829d4588 llvm::DwarfDebug::beginModule()
(/lib64/libLLVM-11.so+0x122a588)
#8 0x00007f848299311b llvm::AsmPrinter::doInitialization(llvm::Module&)
(/lib64/libLLVM-11.so+0x11e911b)
#9 0x00007f848233f1de llvm::FPPassManager::doInitialization(llvm::Module&)
(/lib64/libLLVM-11.so+0xb951de)
#10 0x00007f848234a38e llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/lib64/libLLVM-11.so+0xba038e)
#11 0x000055e11873e73a (/usr/bin/llc+0x1373a)
#12 0x000055e118737436 main (/usr/bin/llc+0xc436)
#13 0x00007f848141f1e2 __libc_start_main (/lib64/libc.so.6+0x281e2)
#14 0x000055e11873754e _start (/usr/bin/llc+0xc54e)
```
I'd expect a warning saying at least that the meta data for debug info are not
valid and hence debug info wont be generated,</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>