Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29280 Discussions

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

GuoYJ
Beginner
742 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
685 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

2 Replies
Steve_Lionel
Honored Contributor III
686 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." 

Steve_Lionel
Honored Contributor III
604 Views

I should also remark that, in my opinion, specifying a length other than (*) for a character dummy argument is a bad idea - it just leads to headaches such as this. 

0 Kudos
Reply