<div dir="ltr">
<div class="gmail_quote"><div link="#0563C1" vlink="#954F72" lang="EN-US">
<div class="m_-3994739271490369780WordSection1">
<p class="MsoNormal">Hi all,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">In the code below, every function in module m is private by default, and only bar() is declared public:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">module m<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">implicit none<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">private<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">public :: bar<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">integer :: arr1(42)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">contains<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> subroutine foo(a)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> integer :: a<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> arr1(1) = 2<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> end subroutine foo<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> subroutine bar(a)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> integer :: a<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> call foo(a)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> end subroutine bar<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">end module m<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">However, in the resulting LLVM IR, no function is declared with an attribute “internal”:</p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">define void @m_foo_(i64* %a) !dbg !5 {<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">L.entry:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> br label %L.LB2_313<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">L.LB2_313: ; preds = %L.entry<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> %0 = bitcast %struct_m_4_* @_m_4_ to i32*, !dbg !10
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> store i32 2, i32* %0, align 4, !dbg !10, !tbaa !12<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> ret void, !dbg !16<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">} <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">define void @m_bar_(i64* %a) !dbg !17 {<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">L.entry:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> br label %L.LB3_314<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">L.LB3_314: ; preds = %L.entry<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> call void @m_foo_(i64* %a), !dbg !18<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> ret void, !dbg !20<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">}<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">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.</p>
<p class="MsoNormal"> </p><p class="MsoNormal">Alexey<br></p><p class="MsoNormal"><u></u></p>
<table style="width:482.4pt;border-collapse:collapse" width="0" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr style="height:28.5pt">
<td style="width:288.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:28.5pt" width="384" valign="top"><br></td><td style="width:194.4pt;padding:0cm 5.4pt 0cm 5.4pt;height:28.5pt" width="259" valign="top"><br></td></tr></tbody></table>
</div>
</div>
</div></div>