Fortran · 820 bytes Raw Blame History
1 ! audit31 Finding 12: character indexing in some pattern made
2 ! IntExtend emit an illegal `sxtw Wd, Wn` because isel always
3 ! used SXTW regardless of source width. isel now picks by the
4 ! SOURCE width (SXTB for 8, SXTH for 16, SXTW only for 32→64)
5 ! and emits MOV for same-width "extends". Task #493.
6 ! CHECK: DEFGH
7 module audit31_sxtw_mod
8 implicit none
9 contains
10 subroutine do_substring(buf, src, n, m)
11 character(len=*), intent(inout) :: buf
12 character(len=*), intent(in) :: src
13 integer, intent(in) :: n, m
14 integer :: j
15 do j = 1, n
16 buf(j:j) = src(m + j : m + j)
17 end do
18 end subroutine
19 end module
20
21 program test
22 use audit31_sxtw_mod
23 implicit none
24 character(len=16) :: a, b
25 a = 'xxxxxxxxxxxxxxxx'
26 b = 'ABCDEFGHIJKLMNOP'
27 call do_substring(a, b, 5, 3)
28 print *, a
29 end program
30