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 have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.

loop with integer to real qp Internal compiler error

pat97269
Beginner
1,366 Views

Hi ,

I have internal compiler error with the following code, trying to convert from int to quadruple precision inside a loop with at least -O2 . Compiler version 14.  It works with double precision.

Thanks

program foo
      implicit none
      integer,parameter ::  q =  selected_real_kind(2*precision(1d0))
      real(q) :: k
      integer :: i
      
      do i=1,100
        k=real(i,q)
        print *,factorial1(k)
      end do
      
      contains
            
              function factorial1(n) result(res)
                      real(q) :: n
                      real(q) :: res
                      integer  :: i
                      res=1._q
                      do i=int(n),1,-1
                        res=res*i
                      end do
              end function factorial1

end program foo 

 

0 Kudos
2 Replies
pat97269
Beginner
1,366 Views

Just for information there is no problem with that version.

 

program foo
      implicit none
      integer,parameter ::  q =  selected_real_kind(2*precision(1d0))
      real(q) :: k
      integer :: i
      
      do i=1,100
        print *,factorial1(i)
      end do
      
      contains
             
              function factorial1(nn) result(res)
                      real(q) :: n
                      real(q) :: res
                      integer  :: i,nn
                      res=1._q
                      do i=nn,1,-1
                      n=real(i,q)
                        res=res*n
                      end do
              end function factorial1

end program foo 

 

0 Kudos
Xiaoping_D_Intel
Employee
1,366 Views

I have opened a bug report DPD200254996 and will keep you updated on it.

Thanks,

Xiaoping

 

0 Kudos
Reply