Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28789 Discussions

IFX vs IFORT on treatments on the string length when using a string type dummy parameter

GuoYJ
Beginner
110 Views

Got a lesson today: IFX and IFORT have different treatments on the string length when using a string type dummy parameter in calling a subroutine in which the string parameter is intent(out). Special attention shoud be paid especially when the string length defined in the subroutine is different than that defined in the caller. With IFORT, the length of the string will be truncated to the defined length in the caller when it is returned from the subroutine in case its length defined in the subroutine is longer. However, with IFX, the length will changed to the length defined in the subroutine thus if the length defined in the caller is smaller, the string will occupy the space of adjacent variables, which will lead to error!

0 Kudos
1 Solution
Steve_Lionel
Honored Contributor III
53 Views

An incorrect program does not have predictable results. "If a present scalar dummy argument is of type character with default kind or C character kind, the length len of the dummy argument shall be less than or equal to the length of the actual argument." 

View solution in original post

1 Reply
Steve_Lionel
Honored Contributor III
54 Views

An incorrect program does not have predictable results. "If a present scalar dummy argument is of type character with default kind or C character kind, the length len of the dummy argument shall be less than or equal to the length of the actual argument." 

Reply