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

Overwritten variables with Ifort for mac

leonardogual
Beginner
540 Views
Dear all,
I have a problem programming with ifort.
I cut out all parts of the program not giving problems, so now there is an elementary program
still giving the problem, and I don't understand why.

If I write the file "prova.f" as
------------------------------------
implicit none
real*8 z(4)
z(1) = 1.d0
z(2) = 1.d0
z(3) = 1.d0
z(4) = 1.d1
print*,z(1)
write(*,101)z(1)
101 format(d16.10)
stop
end
---------------------------------
and compile is as
--------------
ifort prova.f
./a.out
-------------
the output is
--------------
1.626021063200095E-260
0.1626021063-259
---------------
It seems that the variable z(1) has been note stored correctly, and overwritten!
If instead I complile it with
------------------
gfortran prova.f
./a.out
-----------------
or with
-------------------
ifort prova.f -debug -all
./a.out
-------------------
the output is correct, i.e.
------------------------
1.00000000000000
0.1000000000D+01
-----------------------
Which is the problem?

Thanks!

Leonardo



0 Kudos
3 Replies
mecej4
Honored Contributor III
540 Views
You did not state which version of the compiler you used. See if this sticky note at the top of the forum applies to your installation and, if so, try the stated work-around:
Xcode 3.2.2 and 3.2.3 not supported and may cause errors
0 Kudos
leonardogual
Beginner
540 Views
Thanks! My version of Xcode is 3.2.4 and of ifort it is 11.1 20090511,
so the problem is that one explained in your link.
I added -use-asm and it works prefectly.

Leonardo
0 Kudos
Kevin_D_Intel
Employee
540 Views

Hi Leonardo,

Glad the work-around worked for you. Your 11.1 compiler is the original 11.1 release which is fairly dated so you might consider upgrading your compiler at some point too.

There are options available to avoid this known linker/compiler incompatibility and upgrade the compiler:

1. Upgrade to the current 11.1 Update 7 (m_cprof_p_11.1.089 - Build 20100806)
2. Wait one week to upgrade to the 11.1 Update 8 (tentatively the week of 12/13/2010)
3. Upgrade now the new Intel Fortran Composer XE 2011 Update 1 release (m_fcompxe_2011.1.122 - if your support services are current)
4. Upgrade now to Xcode 3.2.5 (containing a new linker that is compatible with symbols produced by the Intel compilers). I recommend upgrading your Intel compiler first to at least the latest 11.1 update 7 or 8 (when available) when choosing this option.

0 Kudos
Reply