Quantcast
Channel: Intel® Fortran Compiler
Viewing all articles
Browse latest Browse all 3270

Why the result depends on -g option and type of function

$
0
0

Just a small program.

      REAL(8) FUNCTION DUMMY(i)
      implicit none
      integer, intent(in) :: i

      DUMMY=dble(i)
      write(*,*) 'i=', dble(i),'res=',DUMMY

      RETURN
      END FUNCTION


      program test
      real(8) :: xxx

      xxx=DUMMY(2)
      write(*,*) 'xxx=',xxx

      stop
      end program

If I do    ifort -o test test.f    the result is
 i=   2.00000000000000      res=   2.00000000000000     
 xxx=   2.00000000000000
But with   ifort -g -o test test.f    the result is
 i=   2.00000000000000      res=   2.00000000000000     
 xxx=  0.000000000000000E+000

The result is also depend on type of my function. If I put REAL DUMMY(i) instead of REAL(8) DUMMY(i) then the result will be always correct.

ifort -V
Intel(R) Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 14.0.2.144 Build 20140120
Copyright (C) 1985-2014 Intel Corporation.  All rights reserved.
FOR NON-COMMERCIAL USE ONLY


Viewing all articles
Browse latest Browse all 3270

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>