Silverfrost Forums

Welcome to our forums

ice with do i = 1,n

10 Jan 2018 6:19 #21101

The following code produces an ICE when compiled with 32-bit or 64-bit when n >= 2**31

  1. do i = 1,n ! works with = one,n *** Error 637: Internal compiler error - floating point exception

However it works with do I = one,n or if n < 2^31

This occurs for Ver 8.20 and earlier versions that I have tested.

   integer*4, parameter :: million = 1000000
   integer*8, parameter :: billion = 1000*million
   integer*8, parameter :: n = 3*billion ! works with 1*billion
   integer*4 :: one = 1
   integer*8 :: i
   real*8    :: s, e, d

   d = 0.001d0
   s = 0
   do i = 1,n   ! works with = one,n
     s = s + d
   end do

   e = n*d
   write (*,*) 'n=',  n
   write (*,*) 's,e=',s, e
   write (*,*) 's-e=',s-e
   end
10 Jan 2018 7:24 #21102

Thanks John. I have made a note of this.

10 Jan 2018 11:22 #21103

integer*4, parameter :: one = 1 ... do i = one,n ! this fails

while integer*4 :: one = 1 ... do i = one,n ! this is ok

10 Jan 2018 11:33 #21104

Hi John I am very much astonished to believe that such a compilation errors exist. But, good that it has been identified. This really helps, to improvise our FTN95. Thank you

10 Jan 2018 12:29 #21107

This has now been fixed for the next release of FTN95.

10 Jan 2018 1:10 #21109

The following variant of John's example involves no REAL variables of any KIND, but the 8.10 compilers (32 and 64 bit targets) abort compilation with a startling error message.

The modified source code:

   program fbug
   implicit none
   integer*8, parameter :: n = 3_4*1000_4*1000_4*1000_4 ! 3 billion
   integer*4 :: one = 1 
   integer*8 :: i , s, d

   print *,' n = ',n
   d = 2
   s = 0

   do i = 1_4,n   ! works with = one,n 
     s = s + d 
   end do 

   write (*,*) 'n, s =',  n , s
   end 

The compiler's error message:

s:\FTN95>ftn95 fbug.f90 /64 /lgo
[FTN95/x64 Ver. 8.10.0 Copyright (c) Silverfrost Ltd 1993-2017]
0011)    do i = 1_4,n   ! works with = one,n
*** Internal compiler error - floating point exception
10 Jan 2018 2:44 #21110

The current fix also works for this variant.

10 Jan 2018 3:26 #21111

Quoted from PaulLaidler The current fix also works for this variant.

Thanks, Paul.

Impressive: A fix was provided to a problem just six hours after the problem was reported!

12 Jan 2018 12:25 #21120

Paul,

Thanks for the prompt response to this and other fixes. Could a Ver 8.21 be made available ?

John

12 Jan 2018 8:05 #21122

John

That is an option that is being considered.

Please login to reply.