Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29281 Discussions

Incorrect result with COUNT in initialization expression

Brian1
Beginner
696 Views

I found that Intel Fortran 15 gives incorrect results with the COUNT intrinsic in initialization expressions. Consider the following program:

program count_bug
  implicit none

  integer, parameter :: npts(2) = (/ 42, 1 /)
  integer, parameter :: ndims = count(npts .gt. 1)

  write (*,'(2(I0, 1X))') count(npts .gt. 1), ndims
end program

When compiled with ifort, the output is "1 -1".  The correct output is "1 1".

This result was obtained with Intel Fortran 15.0.1 20141022 on Mac OS X 10.10.1.

0 Kudos
2 Replies
Steven_L_Intel1
Employee
696 Views

Right you are! Escalated as issue DPD200366183 - thanks for letting us know.

0 Kudos
Steven_L_Intel1
Employee
696 Views

This was a rather interesting bug. Interesting in that it affected only rank-1 arrays - if you called COUNT with an array of two or more dimensions, I am told it worked correctly. I expect the fix to appear in Update 3.

0 Kudos
Reply