ifort 14.0.0 optimization regression?

ifort 14.0.0 optimization regression?

After installing the new ifort 14.0.0, there is a problem in my program. A small function with a loop (DblFac in the attached source code) is being inlined and somehow stuck in an infinite loop. I managed to extract the relevant source file and attached it as sphere.f.

Compiling with "ifort -i8 sphere.f -mkl", the program is stuck in an infinite loop. Using "-fno-inline" works fine, as does disabling optimization with "-O0". Previous versions of ifort did not have this problem, so could this be some regression?

If anyone can help me, or tell me how to find out more about the problem, that would be great.

greetings,

Steven

environment details:
ifort --version: ifort (IFORT) 14.0.0 20130728
uname -a: Linux arch 3.10.10-1-ARCH #1 SMP PREEMPT Fri Aug 30 11:30:06 CEST 2013 x86_64 GNU/Linux 

AdjuntoTamaño
Descargar sphere.f43.86 KB
publicaciones de 7 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.

Hello Steven

I will look into it

Heinz

I see that the option -check bounds suppresses the problem without completely disabling in-lining.  Of course, that's not a solution.

Thanks to you both for looking into it.

FYI: the original code is Fortran 77 and uses some tricks to allocate arrays dynamically, so unfortunately I can't use "-check bounds" there. I did use it once I isolated this single file, to make sure it wasn't a bug on our part (at least, not an obvious bug on our part).

I confirm the regression for 14.0  and it is caused by the in-lining as you assumed in your initial post. Different from the 13.x compiler, the 14.0 compiler in-lines routine NrmSph() too - and this seems to cause the fault. Curiously, the bug disappears in case I textually replace the statment function in NrmSph like changing  :

       temp=temp+P(iad(ix,iy,iz),m)*P(iad(jx,jy,jz),m)

to :

       temp=temp+P((iy+iz)*(iy+iz+1)/2+iz+1,m)* P((iy+iz)*(iy+iz+1)/2+iz+1,m)

And the issue disappears too in case I  compile by -O3 ( the default is -O2).  Both might be workarounds for you. A more reliable workaround would be to put DblFac()  into a seperate source file ( and not using -ipo for compilation): this will prevent the in-lining for sure. 

Later I  will add the case number here when I have entered the issue into our bug tracing system.

I have reported the problem to engineering: Case numer is DPD200248141. I will let you know, when a fix will be available,

Thank you for your efforts.

Regarding the "-O3" option, I did notice something peculiar. It works indeed on the file I attached, but it doesn't work in the actual program. So, I separated out the "main" program at the top of sphere.f and put it in the file main.f. Then I compiled with:

ifort -i8 -O3 main.f sphere.f -mkl

This works as well. However, if I then remove the write statements in the loop inside DblFac (like in the actual program), it goes into an infinite loop again. Removing the write statements in the original sphere.f has no effect, it always works with "-O3".

Adjuntos: 

AdjuntoTamaño
Descargar sphere.f43.65 KB
Descargar main.f110 bytes

Deje un comentario

Por favor inicie sesión para agregar un comentario. ¿No es socio? Únase ya