RTL Functions
As the frontend of the Fortran language, Flang contains a list of RTL (runtime library) function routines. All functions in the RTL function list are built-in functions. BiSheng prefixes these functions with bs_. When writing code in the Fortran language, the user should not call functions with the same names to prevent function redefinition.
Interface Example
FtnRteRtn ftnRtlRtns[] = {
{"f90io_aux_init", "", false, ""},
{"f90io_backspace", "", false, ""},
{"f90io_begin", "", false, ""},
......
Usage Example
These runtime functions are named with a special prefix bs_f90. The following is an incorrect usage example:
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
In this example, the Fortran statement print is used for the preceding RTL function bs_f90io_sc_cf_ldw. As a result, the following errors occur during compilation:
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)
Parent topic: Intrinsic Procedures