[flang-commits] [flang] [flang][debug] Handle USE statements inside modules (PR #186184)
via flang-commits
flang-commits at lists.llvm.org
Fri Apr 17 07:30:35 PDT 2026
https://github.com/jeanPerier approved this pull request.
Thanks, this looks great.
One point that is not clear to me, what happens when some program uses some module A defined in another compilation unit that contains a use of B? Looking at the patch, I would imagine that there will be no `fir.module_debug_imports` created for A because the modules used from other compilation unit are not visited by the PFT, and no debug info generated for B module. Is this also what you expect?
I tested and nvfortran is emitting a DW_TAG_imported_module for B in that case, but ifx/gfortran are not (only generating one for A). IFX is emitting debug info for the variables of B that are used in the program (gfortran 15.2 seems to emit nothing).
modules.f90
```
module modb
integer :: i_from_b = 1
end module
module moda
use modb
integer :: i_from_a = 2
end module
```
main.f90
```
subroutine foo
use moda
implicit none
print *, i_from_b
end subroutine
call foo
end
```
What is the output of:
`flang -c modules.f90 && flang -O0 -g main.f90 modules.o && llvm-dwarfdump ./a.out` with your patch?
I think we would want to at least match IFX in that case, and probably nvfortran.
In any case, this is not a blocking comment, since your patch is an improvement, thanks!
https://github.com/llvm/llvm-project/pull/186184
More information about the flang-commits
mailing list