I have a very strange issue, well, I think it is a stack corruption of some sorts.
First of all, the Linux build (x86 or x64) and Windows (x64) are all ok with latest ifort v14 beta. (Actually, ifort v13.x gives wrong result for x64 bit build). The problem never happens with debug build on Windows, and will go away, if I enable some /check.
So here is the code segment (ncon_beco, kconnod_beco, ncmp_beco, kconcmp_beco are all globals defined in a module)
implicit real (a-h,o-z)
do 300 ki=1,ncon_beco
! print *, 'ki = ', ki
inode1 = kconnod_beco(ki,1)
inode2 = kconnod_beco(ki,2)
C--- Load slave force/torque solution cluster component index for components on both sides of connection
do 250 kk=1,ncmp_beco
inode = kcmpnod_beco(kk)
if(inode.eq.inode1) kconcmp_beco(ki,1) = kk
if(inode.eq.inode2) kconcmp_beco(ki,2) = kk
kk1 = kconcmp_beco(ki,1)
print *, 'kk1 = ', kk1, 'ki = ', ki, 'kconcmp_beco(ki,1) = ', kconcmp_beco(ki,1)
Observation 1) If I print, "print *, 'ki = ', ki", the problem is gone.
Observation 2) if I use /check:bounds, the problem is gone
Observation 3) loop 250 is the real issue, it looks like it is not done: even though kcmpnod_beco(:) is ok, the 2 if() is bypassed, such that kconcmp_beco is not assigned a right value.
Observation 4) Win64 build (with the same compiler options) are working ok (ifort v14) or pass this crash (ifort v13.x) though run into a wrong result later.
Is this indicating some kind of alignment issue?
Normally when a print statement can fix a crash, I will look at the stack local variables around this 'print' location, but in above case, I did not see much in the code this time.
Any idea and suggestion?