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
1 2 3 4 5 6 | FtnRteRtn ftnRteRtns[] = { {"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:
1 2 3 4 5 6 | INTEGER FUNCTION bs_f90io_sc_i_ldw(i, j) IMPLICIT NONE INTEGER, INTENT(in):: i INTEGER, INTENT(in):: j print *, i,j 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:
1 2 3 4 5 6 7 | 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