LLVM invalid debug info in unit finalize/init
Summary
The example unit cannot be debugged when compiled with llvm
System Information
- Operating system: Ubuntu 22.04
- Processor architecture: x86-64
- Compiler version: 3.3.1 36a2835f LLVM
Example Project
A unit containing:
var x: TRTLCriticalSection;
initialization
x := default(TRTLCriticalSection);
InitCriticalSection(x);
finalization
DoneCriticalsection(x);
What is the current bug behavior?
the entire unit cannot be debugged anymore
No breakpoints, no mixed disassembly with source
What is the expected (correct) behavior?
debugging
Relevant logs and/or screenshots
there is an error message during compiling:
mismatched subprogram between llvm.dbg.addr variable and !dbg attachment
call void @llvm.dbg.addr(metadata %typ.SYSTEM.TRTLCriticalSection* %tmp.1, metadata !48637, metadata !DIExpression()), !dbg !48773
label %0
void ()* @"\01XQUERY_$$_finalize$"
!48637 = !DILocalVariable(name: "_zero_$SYSTEM_$$_TRTLCRITICALSECTION", scope: !48635, file: !3, line: 10567, type: !1260)
!48635 = distinct !DISubprogram(name: "XQUERY_$$_init$", scope: !3, file: !3, line: 3506, type: !7606, scopeLine: 10504, spFlags: DISPFlagDefinition, unit: !2)
!48773 = !DILocation(line: 10570, column: 1, scope: !48772)
!48772 = distinct !DISubprogram(name: "XQUERY_$$_finalize$", scope: !3, file: !3, line: 10570, type: !7606, scopeLine: 10570, spFlags: DISPFlagDefinition, unit: !2)
warning: ignoring invalid debug info in /home/theo/lib/fpc/x86_64-linux/xquery.ll