[llvm-dev] workaround for debug info bug?

Andrew Kelley via llvm-dev llvm-dev at lists.llvm.org
Tue Nov 14 20:47:15 PST 2017


I just reported this bug:
https://bugs.llvm.org/show_bug.cgi?id=35314

This very simple IR is causing infinite recursion
in llvm::DwarfUnit::getOrCreateTypeDIE in llvm 5.0.0.

Is there a workaround? Is anyone willing to save me a recompile and check
if this is fixed in 5.0.1 or trunk?

`clang -c test.ll` repros the issue.

; ModuleID = 'test'
source_filename = "test"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%Foo = type { float }
%"[]u8" = type { i8*, i64 }

@0 = internal unnamed_addr constant %Foo zeroinitializer, align 4

; Function Attrs: nobuiltin noreturn nounwind
define internal fastcc void @panic(%"[]u8"* byval nonnull readonly)
unnamed_addr #0 !dbg !4 {
Entry:
  call void @llvm.dbg.declare(metadata %"[]u8"* %0, metadata !18, metadata
!19), !dbg !20
  br label %WhileCond, !dbg !21

WhileCond:                                        ; preds = %WhileCond,
%Entry
  br label %WhileCond, !dbg !21
}

; Function Attrs: nounwind readnone speculatable
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1

; Function Attrs: nobuiltin nounwind
define void @entry() #2 !dbg !24 {
Entry:
  %f = alloca %Foo, align 4
  %0 = bitcast %Foo* %f to i8*, !dbg !36
  call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* bitcast (%Foo* @0 to
i8*), i64 4, i32 4, i1 false), !dbg !36
  call void @llvm.dbg.declare(metadata %Foo* %f, metadata !28, metadata
!19), !dbg !36
  ret void, !dbg !37
}

; Function Attrs: argmemonly nounwind
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8*
nocapture readonly, i64, i32, i1) #3

attributes #0 = { nobuiltin noreturn nounwind
"no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" }
attributes #1 = { nounwind readnone speculatable }
attributes #2 = { nobuiltin nounwind "no-frame-pointer-elim"="true"
"no-frame-pointer-elim-non-leaf" }
attributes #3 = { argmemonly nounwind }

!llvm.module.flags = !{!0}
!llvm.dbg.cu = !{!1}

!0 = !{i32 2, !"Debug Info Version", i32 3}
!1 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, producer:
"zig 0.1.1.1f0d561", isOptimized: false, runtimeVersion: 0, emissionKind:
FullDebug, enums: !3)
!2 = !DIFile(filename: "test", directory: ".")
!3 = !{}
!4 = distinct !DISubprogram(name: "panic", scope: !5, file: !5, line: 10,
type: !6, isLocal: true, isDefinition: true, scopeLine: 10, isOptimized:
false, unit: !1, variables: !17)
!5 = !DIFile(filename: "test.zig", directory: "/home/andy/dev/zig/build")
!6 = !DISubroutineType(types: !7)
!7 = !{!8, !9}
!8 = !DIBasicType(name: "void", encoding: DW_ATE_unsigned)
!9 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "&[]const u8",
baseType: !10, size: 64, align: 64)
!10 = !DICompositeType(tag: DW_TAG_structure_type, name: "[]u8", size: 128,
align: 64, elements: !11)
!11 = !{!12, !15}
!12 = !DIDerivedType(tag: DW_TAG_member, name: "ptr", scope: !10, baseType:
!13, size: 64, align: 64)
!13 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "&u8", baseType: !14,
size: 64, align: 64)
!14 = !DIBasicType(name: "u8", size: 8, encoding: DW_ATE_unsigned_char)
!15 = !DIDerivedType(tag: DW_TAG_member, name: "len", scope: !10, baseType:
!16, size: 64, align: 64, offset: 64)
!16 = !DIBasicType(name: "usize", size: 64, encoding: DW_ATE_unsigned)
!17 = !{!18}
!18 = !DILocalVariable(name: "msg", arg: 1, scope: !4, file: !5, line: 10,
type: !10)
!19 = !DIExpression()
!20 = !DILocation(line: 10, column: 14, scope: !4)
!21 = !DILocation(line: 10, column: 45, scope: !22)
!22 = distinct !DILexicalBlock(scope: !23, file: !5, line: 10, column: 43)
!23 = distinct !DILexicalBlock(scope: !4, file: !5, line: 10, column: 14)
!24 = distinct !DISubprogram(name: "entry", scope: !5, file: !5, line: 6,
type: !25, isLocal: false, isDefinition: true, scopeLine: 6, isOptimized:
false, unit: !1, variables: !27)
!25 = !DISubroutineType(types: !26)
!26 = !{!8}
!27 = !{!28}
!28 = !DILocalVariable(name: "f", scope: !29, file: !5, line: 7, type: !30)
!29 = distinct !DILexicalBlock(scope: !24, file: !5, line: 6, column: 19)
!30 = distinct !DICompositeType(tag: DW_TAG_union_type, name: "Foo", scope:
!30, file: !5, line: 1, size: 32, align: 32, elements: !31)
!31 = !{!32, !34}
!32 = !DIDerivedType(tag: DW_TAG_member, name: "float", scope: !30, file:
!5, line: 2, baseType: !33, size: 32, align: 32)
!33 = !DIBasicType(name: "f32", size: 32, encoding: DW_ATE_float)
!34 = !DIDerivedType(tag: DW_TAG_member, name: "int", scope: !30, file: !5,
line: 3, baseType: !35, size: 32, align: 32)
!35 = !DIBasicType(name: "u32", size: 32, encoding: DW_ATE_unsigned)
!36 = !DILocation(line: 7, column: 5, scope: !29)
!37 = !DILocation(line: 6, column: 19, scope: !24)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171114/1aec54ec/attachment.html>


More information about the llvm-dev mailing list