I looked around and couldn’t find anything about this.
I just wasted hours trying to see why when I called a function with -1, i.e.
call foo(-1)
Inside foo, it prints that value as 1.
I cannot replicate this in a small case (I tried.)
The actual code is
call fstfield_read_emiss (LAT, iun, 'LAT', -1, -1, nsourc, datestt, 0)
where the two -1’s are for the arguments ip2 and ip3. Inside the fstfield_read_emiss function, these are read in as 1. I checked with printing them out, using the debugger, etc.
I’m 100% sure that the right line of code was being called, and that there were being read as 1. I can’t explain it.
I tried declaring an interface for that function in the caller function (this is code I got from somewhere else where they don’t define their interfaces), I then tried calling with key-value pairs, i.e.
call fstfield_read_emiss (FLD=LAT, IUN=iun, IP2=-1, IP3_TMP=-1, VAR='LAT', NSOURC=nsourc, DATESTT=datestt, KT=0)
I re-ordered some of the inputs in the key/value version just to check to see if one was “bleeding” into the other or something (was getting desperate.)
So ya, I can’t replicate it, but I can’t explain it and I’m worried it could happen again.
I’m on a CentOS 5.7 system, using PGI 12.3.
The code was compiled with -g -O0
The only way I could get it to work was to change the -1’s to variables, i.e.
ip2=-1; ip3=-1
call fstfield_read_emiss (LAT, iun, 'LAT', ip2, ip3, nsourc, datestt, 0)
Has anyone ever seen this before?