Question WRT to debug info in flang.

Hello Everyone,

For a typical Fortran program compiled with flang with -g(debuginfo enabled), I’m noticing DW_TAG_lexical_block is getting created as child of the DW_TAG_subprogram.
As a consequence of this debuggers like GDB is not able to show the arguments of the subprogram.
Program snippet -
subroutine sub(foo)
integer, value :: foo
print*,foo
end subroutine
program main
interface
subroutine sub(a)
integer, value :: a
end subroutine
end interface
call sub(11)
end program

Hi, Sourabh.

We’ve confirmed the bug. It can be worked around by removing the VALUE attribute.

Can you file an issue for us on the (current) Flang GitHub site?

https://github.com/flang-compiler/flang/issues

Thank you.

Hi Gary,

Thank you for quick response!
Since I was working/investigating this, so before filing this bug could you please help me clarify a couple of things? WRT to flang.

Are their Blocks(Lexical Blocks) even present at ILM or ILI level, because consider the case of value removed(pass by reference) flang also emit DW_TAG_lexical_block in this case also.

And these lexical blocks have nearly ranges as the parent subroutine. To be exact high_pc are same, but low_pc of lexical block corresponds to prologue end of the subroutine.

0x0000002f: DW_TAG_subprogram
DW_AT_low_pc (0x0000000000201ae0)
DW_AT_high_pc (0x0000000000201b75)

0x000000**: DW_TAG_lexical_block
DW_AT_low_pc (0x0000000000201a**) – marking prologue end of subroutine
DW_AT_high_pc (0x0000000000201b75)

Correct me if I’m wrong here, Fortran Doesn’t have lexical scoping? If it doesn’t have we may have to strip out the Lexical Block creation part, in debug info.

Regarding bug filing should we create a specific bug WRT to Lexical block or a something more generic unable to retrieve formal parameter in case of pass by value arguments or third option will be to keep both of these issues orthogonal to each other.

Please share your thoughts on this.

Thank You,
Sourabh Singh Tomar.

Hello Everyone,

As I was investigating this removal of redundant entry(just after subprogram) Lexical Block, that’s being created by flang. I need to know your(debug info folks) thoughts on this.
I mean are there any existing effort going on this direction? Or anyone interested in discussing about this?

flang behavior as of now–