118 lines · plain
1! RUN: bbc %s -o "-" -emit-fir | FileCheck %s2 3subroutine sub()4 real :: x5 ! CHECK: fir.call @_QPasubroutine()6 call AsUbRoUtInE();7 ! CHECK: fir.call @_QPfoo()8 x = foo()9end subroutine10 11module testMod12contains13 subroutine sub()14 end subroutine15 16 function foo()17 end function18end module19 20subroutine sub1()21 use testMod22 real :: x23 ! CHECK: fir.call @_QMtestmodPsub()24 call Sub();25 ! CHECK: fir.call @_QMtestmodPfoo()26 x = foo()27end subroutine28 29subroutine sub2()30 use testMod, localfoo => foo, localsub => sub31 real :: x32 ! CHECK: fir.call @_QMtestmodPsub()33 call localsub();34 ! CHECK: fir.call @_QMtestmodPfoo()35 x = localfoo()36end subroutine37 38 39 40subroutine sub3()41 real :: x42 ! CHECK: fir.call @_QFsub3Psub()43 call sub();44 ! CHECK: fir.call @_QFsub3Pfoo()45 x = foo()46contains47 subroutine sub()48 end subroutine49 50 function foo()51 end function52end subroutine53 54function foo1()55 real :: bar156 ! CHECK: fir.call @_QPbar1()57 foo1 = bar1()58end function59 60function foo2()61 ! CHECK: fir.call @_QPbar2()62 foo2 = bar2()63end function64 65function foo3()66 interface67 real function bar3()68 end function69 end interface70 ! CHECK: fir.call @_QPbar3()71 foo3 = bar3()72end function73 74function foo4()75 external :: bar476 ! CHECK: fir.call @_QPbar4()77 foo4 = bar4()78end function79 80module test_bindmodule81 contains82 ! CHECK: func @modulecproc()83 ! CHECK: func @bind_modulecproc()84 subroutine modulecproc() bind(c)85 end subroutine86 subroutine modulecproc_1() bind(c, name="bind_modulecproc")87 end subroutine88end module89! CHECK-LABEL: func @_QPtest_bindmodule_call() {90subroutine test_bindmodule_call91 use test_bindmodule92 interface93 subroutine somecproc() bind(c)94 end subroutine95 subroutine somecproc_1() bind(c, name="bind_somecproc")96 end subroutine97 end interface98 ! CHECK: fir.call @modulecproc()99 ! CHECK: fir.call @bind_modulecproc()100 ! CHECK: fir.call @somecproc()101 ! CHECK: fir.call @bind_somecproc()102 call modulecproc()103 call modulecproc_1()104 call somecproc()105 call somecproc_1()106end subroutine107 108! CHECK-LABEL: func @_QPtest_bind_interface() {109subroutine test_bind_interface()110 interface111 subroutine some_bindc_iface() bind(C, name="some_name_some_foo_does_not_inherit")112 end subroutine113 end interface114 procedure(some_bindc_iface) :: foo5115 ! CHECK: fir.call @foo5116 call foo5()117end118