Skip to content

[flang][debug] Scope of the contained subroutine is not correct. #96314

Closed
@abidh

Description

@abidh

If the following program is compiled with flang, the scope of sub1 is not the parent function that contains it. As a result, when control is stopped in sub1, debugger fails to evaluate the variable in parent function (e.g.i) .

with gfortran

Breakpoint 1, test::sub1 (m=2) at ../../test1.f90:11
11          print *, "sub1: ", m
(gdb) p i
$1 = 2

With flang

Breakpoint 1, sub1 (m=2) at ../test1.f90:11
11          print *, "sub1: ", m
(gdb) p i
No symbol "i" in current context.
program test
  integer i
  i = 2
  call sub1(i)
  i = i + 1
  call sub2(5)
  print *, i
contains
  subroutine sub1(m)
    integer m
    print *, "sub1: ", m
  end subroutine sub1
end program test

subroutine sub2(n)
    integer n
    print *, "sub2: ", n
end subroutine sub2

Metadata

Metadata

Assignees

Labels

bugIndicates an unexpected problem or unintended behaviorflang:ir

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions