RTL库函数
作为fortran语言的前端,Flang内部包含有RTL(run time library)库函数例程清单,RTL库函数清单所含的函数为运行阶段内嵌套库函数,毕昇会将这些函数加入“bs_”前缀。在用户层面使用fortran语言进行编码时,应避免调用同名函数,以防止函数重定义的出现。
接口举例
FtnRteRtn ftnRtlRtns[] = { {"f90io_aux_init", "", false, ""}, {"f90io_backspace", "", false, ""}, {"f90io_begin", "", false, ""}, ......
使用举例
这些运行时函数,命名以特殊的"bs_f90"为前缀,错误的使用案例如下:
INTEGER FUNCTION bs_f90io_sc_i_ldw(i, j) IMPLICIT NONE INTEGER, INTENT(in):: i INTEGER, INTENT(INOUT):: j print *, i,j j = j + 1 END FUNCTION bs_f90io_sc_i_ldw
该用例使用fortran语言‘print’的上述RTL里的运行时库函数bs_f90io_sc_cf_ldw,导致编译时出现如下错误:
F90-W-0155-bs_f90io_sc_i_ldw - PURE subprograms may not contain external I/O statements (f90io_sc_i_ldw.f90: 5) 0 inform, 1 warnings, 0 severes, 0 fatal for bs_f90io_sc_i_ldw F90-S-0000-Internal compiler error. gen_funcret: illegal dtype, sym 0 (f90io_sc_i_ldw.f90: 7) F90-S-0000-Internal compiler error. get_llvm_name: bad stype for 0 (f90io_sc_i_ldw.f90: 7) ...... F90-S-0000-Internal compiler error. get_llvm_name: bad stype for 0 (f90io_sc_i_ldw.f90: 7) F90-F-0000-Internal compiler error. make_lltype_from_sptr(), no incoming arguments 0 (f90io_sc_i_ldw.f90: 7)
父主题: Intrinsic Procedures