- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
The following is its assembly:
[cpp]0000000000403430
[]$ 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.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, there is not changing any of its arguments. I fixed it. Now, it worked. Thanks for your tips.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page