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.
29285 Discussions

Effect of presence of array constructor in call argument

abhimodak
New Contributor I
542 Views
(I know without a program snippet it is difficult to give a verdict but I don't have such snippet.)

I see the following behavior in a large program.

----
Module SomeModule

Implicit None

Contains

Subroutine SomeMethod
if (condition) then
Call Process([],[], arg1,arg2,iError) ! [] => array constructor; process is in another module
! arg1 and arg2 are optional.
endif

End Subroutine

End Module
-------

Condition is set to .False. Thus, the call never happens.

The only difference I make is that in one run the if-block is commented out while the other keeps it. The program uses -O2 (no debug). I get small differences when comparing the results of these runs. In the full debug with no optimization, there is no difference. I checked (in the debug mode) that no array-temporary is created. (No such thing should happen in first place since the call never happens.)

Any clues?

Abhi
0 Kudos
2 Replies
Steven_L_Intel1
Employee
542 Views
As you say, without a test case (even a "snippet" is inadequate), trying to hypothesize on a cause is not worthwhile. Does the call happen if optimization is disabled?
0 Kudos
abhimodak
New Contributor I
542 Views
Hi Steve

The (condition) is always false and hence the happens neither in debug nor in optimized. {However, (condition) is not known at compile-time.}

I definitely see the following behavior:-
(1) compiled with /O2 -- Answer 1.
(2) The only change in the enitre source code is to comment out the call in this particular file, compile with /O2 as before -- Answer 2.

It is not that Answer 1 and 2 are greatly different (well below engineering tolerance) but small numerical pertubations. That makes me think that somehow the stack is changed and as we use MKL some 16-byte alignment issue.

The called subroutine is in a module so the interface is explicit. May be that is not sufficient.

Pardon the lack of a concrete test case, my current option is to create a new array and copy (instead of array constructor).

Abhi
0 Kudos
Reply