Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
34 Views

using Qinit:snan leads to a floating invalid error

Last week I created a post on this forum describing a "floating invalid" error message I am getting.
Through some trial and error, I believe I have found the "smoking gun", or at least something that is contributing to the "(65) floating invalid" error.
I have recreated my code with a very simple example (see below).  I first initialize a large table array at zero.  Then I fill rows 1 and 2 of the table with some numbers.  I then simply divide the value in column 1 with the value in column 2, but only if the value in column 2 is positive.  I put the result in column 3.

I get the error if I compile using the compiler option "/Qinit:snan", as in:
    ifort /libs:dll /traceback /Qinit:snan /c test2.f90
 
The program runs fine if I remove the compiler option, as in:
    ifort /libs:dll /traceback /c test2.f90

Also, what is strange is that if I write out the values of column 1 and 2 before doing the divide, the program runs fine, even with the /Qinit:snan option.
In my example below, I have commented out this write statement.

-------------------------------------------------------------------------------------------------------------------------
      program test2

      double precision xa(3,3,100000)
      data xa /900000*0./

      xa(1,01,1) = 0.
      xa(1,02,1) = 0.
      xa(2,01,1) = 40000000.
      xa(2,02,1) = 100.
      xa(3,01,1) = 10000000.
      xa(3,02,1) = 5.

      do 800 i=1,3
!      write(6,50) i, xa(i,01,1), xa(i,02,1)
! 50   format(1x,'check here',i4,2f10.0)
        if (xa(i,02,1) > .01) xa(i,03,1) = xa(i,01,1) / xa(i,02,1)
 800  continue
       
      do 810 i=1,3
        write(6,100) i, xa(i,01,1), xa(i,02,1), xa(i,03,1)
 100    format(1x,'results',i4,3f10.0)
 810  continue
      end
-------------------------------------------------------------------------------------------------------------------------

I am running Visual Fortran Intel(R) 64 Compiler XE .... Version 15.0.7.287

So, thoughts experts?  Why is this compiler option causing problems?  Is removing this compiler option something I should be worried about?

Thanks in advance.

Jim

0 Kudos
3 Replies
Highlighted
Valued Contributor III
34 Views

@Cilke, Jim:

My hunch is the issue you are facing is either with your specific Intel Fortran compiler version 15.0.7 or a set of  compiler versions around the one you are using i.e., recent versions of the compiler such as 18.0.3 do not seem to having this problem.  If so, the ball will likely be in your court for you to decide how to workaround your issue such as not use that particular compiler option or use a different compiler version, etc..

Good luck,

0 Kudos
Highlighted
Beginner
34 Views

No such error occurs with IFort 18.0.3 (64-bit or 32-bit). Your test code may have exposed a bug in the 4-year old compiler, and there would be little interest in supporting an old compiler.

That said, what is the purpose of your using the /Qinit:snan option? I can certainly guess that it would be a useful option (among others) in detecting uninitialized variables in a test program; with a program that does not have such a bug, the option would have no useful purpose (other than making bugs in old compilers resurface!).

0 Kudos
Highlighted
Beginner
34 Views

Further testing on a different PC with other versions of IFort showed that the bug is present in 17.0 Update 6, but not in 18.0 Initial Release, if the optimization level is /Ot or higher.

If you do not wish to update to a newer version of the compiler, you can (i) use /Od /Qinit:snan when debugging your code, and (ii) do not use /Qinit:snan if any level of optimization is used (specified or by default) when compiling your sources.

0 Kudos