Bug in AVX optimization in ifort 14.0.1/Linux64

Bug in AVX optimization in ifort 14.0.1/Linux64


Hi all,

if I compile the following program with "ifort -mavx", the contents of array "copy" are bogus. If I reduce n to 9, the program crashes. With "-msse3", everything is fine. It seems the optimizer is a bit too eager...

      program avxfail

      implicit none

      integer, parameter:: n = 30

      real dat(n) , copy(3,n/3)
      integer i, ia, ie

      do i = 1,n
         dat(i) = 1.0 * i
      end do
      ia = -2
      ie = 0

      do i = 1, 10
         ia = ie + 1
         ie = ie + 3
         copy(1:3,i) = dat(ia:ie)
      end do

      write(*,*) 'Dat'
      write(*,*) dat
      write(*,*) 'Copy'
      do i = 1,n/3
         write(*,*) copy(1:3,i)
      end do



System details:

$ cat /etc/issue
Welcome to SUSE Linux Enterprise Desktop 11 SP2  (x86_64) - Kernel \r (\l).

$ uname -a
Linux abcdefgh 3.0.93-0.5-default #1 SMP Tue Aug 27 08:17:02 UTC 2013 (925d406) x86_64 x86_64 x86_64 GNU/Linux

$ ifort --version
ifort (IFORT) 14.0.1 20131008
Copyright (C) 1985-2013 Intel Corporation.  All rights reserved.


Best regards,


4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Martyn Corden (Intel)'s picture

Thanks for your report.

I don't see a crash for n=9, provided you change your loop limit from 10 to n/3. In that case, the loop is too short to be worth vectorizing, and the results are correct. I agree, however, that the incorrect results for n=10 are a bug. I'm forwarding this to the developers for a fix.  Incidentally, the results with -msse3 are correct only because the compiler decides the loop is not worth vectorizing with SSE3, otherwise there would be the same issue as with -mavx.

One workaround, amongst others, is to place a  !DIR$ NOVECTOR   directive before a loop with this structure.

Martyn Corden (Intel)'s picture

A fix for this issue has been identified and is being targeted for a future compiler update.

Martyn Corden (Intel)'s picture

This issue has been fixed in update 3 to the 14.0 compiler,  (, which is available for download at the Intel Registration Center, https://registrationcenter.intel.com .  Thanks for the report.

Login to leave a comment.