Jed Brown <[email protected]> writes: > Huh? Or a test that uses enough arguments to not pass in registers if > you insist on creating a test failure. Alternatively, do what the > documentation says. If you doubt the documentation, we can check the > assembly. > > $ cat stringarg.f > > subroutine stringarg(s) > > > character(*) s > end > > With gfortran-7.3.1: > > 0000000000000000 <stringarg_> push rbp > > > 0000000000000001 <stringarg_+0x1> mov rbp,rsp > 0000000000000004 <stringarg_+0x4> mov QWORD PTR [rbp-0x8],rdi > 0000000000000008 <stringarg_+0x8> mov DWORD PTR [rbp-0xc],esi > 000000000000000b <stringarg_+0xb> mov eax,DWORD PTR [rbp-0xc] > 000000000000000e <stringarg_+0xe> cdqe > 0000000000000010 <stringarg_+0x10> mov rdx,rax > 0000000000000013 <stringarg_+0x13> mov ecx,0x0 > 0000000000000018 <stringarg_+0x18> pop rbp > 0000000000000019 <stringarg_+0x19> ret > > > Note the use of esi instead of rsi for the integer argument: > > 0000000000000008 <stringarg_+0x8> mov DWORD PTR [rbp-0xc],esi > > Presumably if you build with gfortran-8.1, the analogous line will use > rsi.
Confirmed with gfortran-8.1: 0000000000000000 <stringarg_> push rbp 0000000000000001 <stringarg_+0x1> mov rbp,rsp 0000000000000004 <stringarg_+0x4> mov QWORD PTR [rbp-0x8],rdi 0000000000000008 <stringarg_+0x8> mov QWORD PTR [rbp-0x10],rsi 000000000000000c <stringarg_+0xc> mov rax,QWORD PTR [rbp-0x10] 0000000000000010 <stringarg_+0x10> mov rdx,rax 0000000000000013 <stringarg_+0x13> mov ecx,0x0 0000000000000018 <stringarg_+0x18> pop rbp 0000000000000019 <stringarg_+0x19> ret
