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

A very strange action from Intel Fortran while returning value from a function

hamid3252
Beginner
375 Views
Hi,
I am using intel Fortran 11 on Linux in order to develop ABAQUS user material (UMAT) subroutine (written in Fortran 90). I put a very simple function which returns an integer (e.g. 1 for simplicity). When I log the return value, surprisingly it returns 124 or 125! I didn't have this issue in windows and I am really confused by this strange action. I am wondering whether the problem/bug is because of the common variables I defined in another file which is also included or it's just a bug which has something to do with other parts of the code!?!? Here is the compile command I am using:
ifort -c -fPIC -auto -extend_source -w90 -w95 -WB Umat-Main-Mgr-Test-0025.f90
and here is the body of my function:
integer function testFunc()
!{
testFunc=1
return
!}
end function testFunc
Thanks,
Hamidreza,
0 Kudos
1 Reply
mecej4
Honored Contributor III
375 Views
There is too little information given to attempt a systematic hunt for the culprit. If you can construct an example that is independent of Abaqus, chances of success may improve.

Just a thought: does the caller know that testFunc is of type INTEGER? If there is no explicit declaration, the compiler may think that the function is REAL, and the return value may be expected to be in ST0 register instead of EAX/RAX. That would explain the surprising return values.
0 Kudos
Reply