Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

A bug?

Rodolfo_Araya
Beginner
266 Views

Hi,

I'm using intel fortran on a mac (ifort version 16.0.3) and I think that there is a possible bug with the MAXLOC function.

When I run the testing.f90 program I get:

           1
           1
           2
           3
           1

using gfortran I get, which in my opinion is the right answer,

          0
           1
           2
           3
           0

Am I right?

Best,

Rodolfo

 

 

0 Kudos
3 Replies
Kevin_D_Intel
Employee
266 Views

No this is not a bug but just a difference in the default treatment between the compilers for your case.

There’s a related discussion from the earlier post here.

For your case, you can consider adding the option: -assume noold_maxminloc

You can refer to the User’s guide for additional information on MAXLOC and -assume noold_maxminloc

$ ifort -V
Intel(R) Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 16.0.3.210 Build 20160415
Copyright (C) 1985-2015 Intel Corporation.  All rights reserved.

$ ifort u629301.f90; ./a.out
           1
           1
           2
           3
           1
$ ifort -assume noold_maxminloc u629301.f90; ./a.out
           0
           1
           2
           3
           0

0 Kudos
Rodolfo_Araya
Beginner
266 Views

OK, may thanks for the answer!!

Regards,

Rodolfo

0 Kudos
TimP
Honored Contributor III
266 Views

gfortran doesn't attempt simd optimization of maxloc.  For some reason, ifort simd optimization is still tied to old_maxminloc, and the 2 most recent releases have returned to no simd optimization with noold_maxminloc.

Note that ifort -standard-semantics is the option for supporting f2003 (including noold_maxminloc), with the additional requirement of -fp-model precise for IEEE_arithmetic (which disables more auto-vectorization).

0 Kudos
Reply