I am debugging a Fortran program with DDT, but the value of an allocatable character variable (character(len = :), allocatable :: s) appears to be empty until it is passed into a subroutine. Is there a way to show the value in DDT?
Hi John,We have looked into the root cause and it turns out that, for derived types in fortran, the deferred length string property is unavailable and instead there is another particular non-standard value available i.e. _in_derived_type_length. This value can be cast on a character pointer - char* - and accessed indirectly that way at-least when using gcc. (Image attached)
For standard data types in fortran, DW_AT_string_length value is available in general for gcc compilers but unfortunately not for the intel ones. So going ahead if gcc(gfortran) is your primary compiler of choice, there is a clear fix available ahead but not in case of an Intel compiler, which doesn't have the standard length value as mentioned above.Let me know if you're ok with this.
RegardsSuyash
Hi Suyash,
Thank you for the update. It's good to know there is a workaround for gfortran. Unfortunately, I am mainly using the Intel compiler. In the Intel implementation, the derived type seems to hold a pointer to a null terminated string. Is there a way to view that string using casting?
Regards,
John
Hi John,Unfortunately for Intel the DW_AT_string_length field doesn't even exist which can only happen when Intel provides the DWARF information which would be a decision of the DWARF committee. Until then it will not be possible to useany kind of workaround to get the string.Sorry about that.RegardsSuyash