[flang-dev] Fwd: Internal linkage for private subroutines

Alexey Zhikhartsev via flang-dev flang-dev at lists.llvm.org
Wed Dec 4 16:49:25 PST 2019


Hi all,



In the code below, every function in module m is private by default, and
only bar() is declared public:



module m



implicit none

private

public :: bar

integer :: arr1(42)



contains



  subroutine foo(a)

  integer :: a



  arr1(1) = 2



  end subroutine foo



  subroutine bar(a)

  integer :: a



  call foo(a)



  end subroutine bar

end module m



However, in the resulting LLVM IR, no function is declared with an
attribute “internal”:



define void @m_foo_(i64* %a) !dbg !5 {

L.entry:

  br label %L.LB2_313



L.LB2_313:                                        ; preds = %L.entry

  %0 = bitcast %struct_m_4_* @_m_4_ to i32*, !dbg
!10

  store i32 2, i32* %0, align 4, !dbg !10, !tbaa !12

  ret void, !dbg !16

}



define void @m_bar_(i64* %a) !dbg !17 {

L.entry:

  br label %L.LB3_314



L.LB3_314:                                        ; preds = %L.entry

  call void @m_foo_(i64* %a), !dbg !18

  ret void, !dbg !20

}



Am I missing something? I tried to find where it might be implemented in
flang by grepping the flang codebase for SC_STATIC but there’s just too
many places. Any pointers would be much appreciated.



Alexey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/flang-dev/attachments/20191204/cc6cf16f/attachment.html>


More information about the flang-dev mailing list