lpython icon indicating copy to clipboard operation
lpython copied to clipboard

Debug scopes are not handled for loops

Open advikkabra opened this issue 1 year ago • 0 comments

In the example code here,

i: i32
for i in range(10):
    q: i32 = 10
    j: i32
    for j in range(5):
        p: i32 = i+1

the following error pops up:

code generation error: asr_to_llvm: module failed verification. Error:
conflicting debug info for argument
  call void @llvm.dbg.declare(metadata i32* %p, metadata !10, metadata !DIExpression()), !dbg !17
!7 = !DILocalVariable(name: "j", arg: 1, scope: !3, file: !1, line: 4, type: !8)
!10 = !DILocalVariable(name: "p", arg: 1, scope: !3, file: !1, line: 6, type: !8)

This is due to both j and p being in the same scope when declaring the DILocalVariable, even though they are not in the same scope.

advikkabra avatar Jun 13 '24 11:06 advikkabra