[flang-commits] [flang] [flang] Add debug information for module variables. (PR #91582)

Abid Qadeer via flang-commits flang-commits at lists.llvm.org
Wed May 15 09:08:23 PDT 2024


abidh wrote:

> The patch adds debug info for other kind of globals (besides module variables) like for eg. `x` in the following case. Is that the intention? If so a test would be good.
> 
> ```
> subroutine abc
>   integer :: x = 2
>   print *, x
> end subroutine
> ```
> 
This was not intentional. The variable with save attribute should be added as global but with scope limited to the subroutine. I will add a check to skip them in this patch.

On a related note, while processing `DeclareOp` of such variables, are you aware of anything that will tell me that these variables have `save` attribute? I ask because I noticed that they are being added as local variable too.

> Commonblocks also are globals but I did not see debug for them.
> 

Yes, common blocks are not supported yet.

> I am guessing the following points will come in future patches. -> Renamed module variables using `use` statement. -> Private module variables. Can they be distinguished in DWARF? -> Submodules

Private module variable should work with this patch. I was not aware of the renaming by the `use` statement syntax. I will add it in my todo list. `DWARF` has concept of `DW_TAG_imported_declaration` for such cases. I will have to see if we have enough information to generate it.


https://github.com/llvm/llvm-project/pull/91582


More information about the flang-commits mailing list