Skip to content

Commit de5967f

Browse files
committed
[llvm] Fix assertion error where we didn't check fixed point types.
1 parent 705fcd4 commit de5967f

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,12 +224,15 @@ bool DebugHandlerBase::isUnsignedDIType(const DIType *Ty) {
224224
Encoding == dwarf::DW_ATE_float || Encoding == dwarf::DW_ATE_UTF ||
225225
Encoding == dwarf::DW_ATE_boolean ||
226226
Encoding == dwarf::DW_ATE_complex_float ||
227+
Encoding == dwarf::DW_ATE_signed_fixed ||
228+
Encoding == dwarf::DW_ATE_unsigned_fixed ||
227229
(Ty->getTag() == dwarf::DW_TAG_unspecified_type &&
228230
Ty->getName() == "decltype(nullptr)")) &&
229231
"Unsupported encoding");
230232
return Encoding == dwarf::DW_ATE_unsigned ||
231233
Encoding == dwarf::DW_ATE_unsigned_char ||
232234
Encoding == dwarf::DW_ATE_UTF || Encoding == dwarf::DW_ATE_boolean ||
235+
Encoding == llvm::dwarf::DW_ATE_unsigned_fixed ||
233236
Ty->getTag() == dwarf::DW_TAG_unspecified_type;
234237
}
235238

llvm/test/DebugInfo/fixed-point.ll

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
;; This fixes https://github.com/llvm/llvm-project/issues/81555
2+
;; Note this isn't correct dwarf but we just need to assert this doesn't crash.
3+
; RUN: %llc_dwarf %s -filetype=obj
4+
5+
define void @func() !dbg !26 {
6+
entry:
7+
%classifier = alloca i32, align 4
8+
tail call void @llvm.dbg.value(metadata i32 32768, metadata !37, metadata !DIExpression()), !dbg !39
9+
store i32 32768, ptr %classifier, align 4, !dbg !39
10+
ret void
11+
}
12+
13+
declare void @llvm.dbg.value(metadata, metadata, metadata)
14+
15+
!llvm.dbg.cu = !{!0}
16+
!llvm.module.flags = !{!19}
17+
18+
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, emissionKind: FullDebug)
19+
!1 = !DIFile(filename: "a", directory: "")
20+
!6 = !DIBasicType(name: "", size: 32, encoding: DW_ATE_signed_fixed)
21+
!19 = !{i32 2, !"Debug Info Version", i32 3}
22+
!3 = !DISubroutineType(types: null)
23+
!26 = distinct !DISubprogram(unit: !0, type: !3)
24+
!37 = !DILocalVariable(name: "intercept", arg: 2, scope: !26, file: !1, line: 7, type: !6)
25+
!39 = !DILocation(line: 0, scope: !26)
26+

0 commit comments

Comments
 (0)