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

Tip for detecting unitialised components

Andrew_Smith
Valued Contributor I
322 Views
Intel Fortran can not yet detect unitialised components so here is a good way to do this. It only works for floating point and not allocatable arrays. You will find NaN will spread from any calculation using an unitialized variable. It is a bit like the existing compiler option to Initialise to an unusual value, but better. It would be nice if Intel changed that option to use NaN for floats.

Define a paramemeter such as "DEBUG" in the debug configuration but not the release configuration, then use the following way to define real components:

module BearingMod
implicit none
real, parameter :: aNaN = 0.0/0.0

type BearingRow
!DEC$ if defined(DEBUG)
real :: ballDiameter = aNaN
real :: clearance = aNaN
!DEC$ else
real :: ballDiameter
real :: clearance
!DEC$ end if
end type
end module



0 Kudos
0 Replies
Reply