On the creation of temporary arrays when passing type element arguments

My hypothesis is that in the original code the array of structures is passed by value (copying takes a lot of time), and in the new code it is passed by reference. But of course the compiler needs to verify that it is not modified into the subroutine because of the intent(in).

Note that in C, arrays are passed by reference. But in Fortran things seems more complicated:

Note that the L variable could also be declared as intent(in).

1 Like