Skip to content

Verifier error if unwinding used in same module as _Unwind_Resume definition with debug info #57469

Closed
llvm/llvm-project-release-prs
#141
@nikic

Description

@nikic
; RUN: opt -S -mtriple=x86_64-linux-gnu -dwarfehprepare < %s
define void @_Unwind_Resume(ptr %ptr) !dbg !4 {
  ret void, !dbg !11
}

declare i32 @__gxx_personality_v0(...)
declare void @might_throw()

define void @simple_cleanup_catch() personality ptr @__gxx_personality_v0 !dbg !12 {
  invoke void @might_throw()
          to label %exit unwind label %landingpad, !dbg !15

exit:
  ret void

landingpad:
  %ex = landingpad { ptr, i32 }
      cleanup
  resume { ptr, i32 } %ex
}

!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!2, !3}

!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 16.0.0 (https://github.com/llvm/llvm-project.git a4c8fb9d1f46f30c66a9ca0dd07c7933f338bb34)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
!1 = !DIFile(filename: "/app/example.c", directory: "/app")
!2 = !{i32 7, !"Dwarf Version", i32 4}
!3 = !{i32 2, !"Debug Info Version", i32 3}
!4 = distinct !DISubprogram(name: "_Unwind_Resume", scope: !5, file: !5, line: 1, type: !6, scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !9)
!5 = !DIFile(filename: "example.c", directory: "/app")
!6 = !DISubroutineType(types: !7)
!7 = !{null, !8}
!8 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64)
!9 = !{!10}
!10 = !DILocalVariable(name: "exception", arg: 1, scope: !4, file: !5, line: 1, type: !8)
!11 = !DILocation(line: 2, column: 1, scope: !4)
!12 = distinct !DISubprogram(name: "test", scope: !5, file: !5, line: 4, type: !13, scopeLine: 4, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0)
!13 = !DISubroutineType(types: !14)
!14 = !{null}
!15 = !DILocation(line: 6, column: 1, scope: !12)

Results in the following verifier error for the inserted _Unwind_Resume call:

inlinable function call in a function with debug info must have a !dbg location
  call void @_Unwind_Resume(ptr %exn.obj) #0

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions