Dear Support,
We are currently trying to run our code with the PGI compiler instead of the Intel compiler. We are using PGI 11.8. The code compiles and runs fine under the Intel compiler. However with PGI it compiles fine but we’re getting run time errors. This is on RedHat Linux 5.3
The code is mixed language of Fortran, C, and, and C++. This is the first time for us to use the PGI compiler with mixed Fortran and C++ code. The issue we are seeing is that variables being passed from Fortran to C++ get messed up.
I am not able to post the actual code, but below is an example of how it looks like.
The Fortran code looks something like:
character(len=*) :: myVariable
myVariable = 'DEEP'
PRINT *,'myVariable while in Fortran is ', myVariable
call test(myVariable)
.
.
.
The C++ code looks something like:
extern "C"
{
void test(char *myVariable)
{
cout << "myVariable after getting passed to cpp is ";
cout << myVariable;
.
.
.
Running the program gives the below result, the variable seems to get extra junk characters at the end which are showing up as question marks after it’s passed to C++ which messes up if-statement checks that follow:
myVariable while in Fortran is DEEP
myVariable after getting passed to cpp is DEEP????
NOTE: When I copied the question marks to be posted in this forum, they got pasted as \ufffd\ufffd\ufffd\ufffd, so I just changed them back to the question marks for the posting.
The Intel compiler flags we use are (these are working fine):
Fortran: -w -pc64 -openmp_stubs -fp-model precise -cpp -assume buffered_io -assume byterecl -prefetch -traceback -132 -O3 -xP -ftz
C/C++: -ftz -O3
Fortran linker: Same as Fotran flags in addition to -cxxlib
The PGI compiler flags we are using:
Fortran: -w -pc 64 -Mnoopenmp -Kieee -Mpreprocess -Mbyteswapio -Bstatic -Mextend -fast -Mvect=nosizelimit
C/C++: -Bstatic -fast
Fortran linker: -lC -lstd
I am not sure what’s wrong here, could I be missing compiler or linking flags or is there something wrong with the way the call and passing is done?
Thank you for your help in advance.
sindimo