ifort 8.1 and 9.0 optimization Bug?

ifort 8.1 and 9.0 optimization Bug?

Hi,
I'm still not sure if I'm right but I assume that there is a optimization (-O3) bug while I'm calling (the reference) BLAS routines in Fortran 90. For example:
double precision :: cwavef(2:npw) ! this is a complex number
! please don't ask why I don't use double complex - It's not my code :)
----
do ipw=1,npw
cwavef(1,ipw)=cg(1,ipw+npw*(iband-1)+icg)
cwavef(2,ipw)=cg(2,ipw+npw*(iband-1)+icg)
end do
----
works well. If I replace this with:
----
call ZCOPY(npw, cg(1,npw*(iband-1)+icg+1), 1, cwavef, 1)
----
The code does not work (converge) anymore. If I try to debug the behavior with write statements:
----
call ZCOPY(npw, cg(1,npw*(iband-1)+icg+1), 1, cwavef, 1)
write(*,*) '1', cwavef(1,1:3)
write(*,*) '2', cwavef(2,1:3)
----
the code works :-(. If I remove every optimization (-O0), the BLAS code (ZCOPY) works without problems, but the result is much slower.

Is there any possibility (workaround) to get the real results without writing the data to the console? It looks like (but I am not sure) that the first element of the vector cwavef is lost during the ZCOPY call with optimization.

1 envío / 0 nuevos
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.