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

ifort optimize wrong

GHui
Novice
656 Views
I code a subroutine of fortran. When I compiled it with -O2, it has been optimized to none.
The following is its assembly:
[cpp]0000000000403430 : funcxx_(): 403430: c3 retq 403431: 48 8d b4 26 00 00 00 lea 0x0(%rsi),%rsi 403438: 00 403439: 48 8d bf 00 00 00 00 lea 0x0(%rdi),%rdi [/cpp]


[]$ ifort -V
Intel Fortran Intel 64 Compiler XE for applications running on Intel 64, Version 12.1.1.256 Build 20111011
Copyright (C) 1985-2011 Intel Corporation. All rights reserved.

0 Kudos
2 Replies
Arjen_Markus
Honored Contributor II
656 Views
Without knowing the source code it is difficult to guess what may be wrong.
But one reason is: the subroutine (or function?) is not changing any of its arguments
nor is it producing any side effects. In that case the compiler could decide it is not
doing anything useful, so why bother?

Here is a simple example:

subroutine donothing( a )
real, dimension(:) :: a

real :: b

b = 2.0
end subroutine donothing

The dummy argument a is not used, and whatever it does to the local variable b
has no impact on the rest of the program.

Regards,

Arjen
0 Kudos
GHui
Novice
656 Views
Yes, there is not changing any of its arguments. I fixed it. Now, it worked. Thanks for your tips.
0 Kudos
Reply