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

Stack based locals and subroutines

dajum
Novice
539 Views

If I have a subroutine local variable (Real) that is allowed to be on the stack, I don't initialize the variable in the routine and call another subroutine and pass that variable as an argument (knowing the called routine will set it and return). Can there be a problem with FP Execptions? If the stack value is such that that varible ends up being NaN, can it cause the program to throw an exception by passing that NaN to the subroutine?

Dave

0 Kudos
1 Reply
Steven_L_Intel1
Employee
539 Views
No, because what you're really passing is the address of the variable, not its value. As long as you store into it before reading from it, you'll be fine.
0 Kudos
Reply