size_t v.s. int issue

Dear Support,

I have a mixed language application (Fortran and C++) and I am currently having a problem with char array sizes when they get passed from Fortran to C++. I receive the array length in C++ as “size_t”. If I run the application through a debugger it’s showing the array lengths corrupted. If I change the array length to “int” instead of “size_t”, things get fixed. When using the Intel compiler I don’t have any issues with size_t. It seems that size_t behaves differently from one compiler to another. We have a few thousand lines of code and I don’t want to change all the instances of size_t into int. Is there a way to get around this (e.g. compiler flags). I am running on RedHat 5.3 64-bit. I am using PGI 11.8. Compilation flags being used:

Fortran: -pgcpplibs -w -pc 64 -Mnoopenmp -Kieee -Mpreprocess -Mbyteswapio -Bstatic

C++: -w -Bstatic

Thank you for your help.

Hi Sindimo,

Unfortunately, there’s nothing we can do in the short term with the 2011 compilers, but in talking with our compiler engineers this should be fairly simple to add. I’ve put in a feature request (TPR#18370) for this support. We’ll try to get this in the first PGI 2012 release but it’s very late in the development cycle so may not make it. If not, then it will most likely be available in the February release.