forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Odd bug in CHECKMATE mode

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Sat Mar 18, 2017 12:31 am    Post subject: Odd bug in CHECKMATE mode Reply with quote

The following code fragment prints the value of k twice. The result should be that K=1, then K=0.

However, if the default integer type is set to 2, the results show 1 and 441344.

If you compile this for RELEASE with the same options, the error does not occur.

If I change the type of "k" to INTEGER or INTEGER*2, the code will work as it should.

Code:

   character*1 ft_returned(1000000)
    integer*4 q,p,rows,cols,k
    do k=1,1000000
      ft_returned(k) = char(k)
    end do
    rows=7
    cols=15
    do p=0,rows-1
       do q=0,cols-1
          k = ichar(ft_returned((q)+(p*cols)+1))
          print *,k
          k = k / 64
          print *,k
          pause
       end do
    end do
    stop
    end
Back to top
View user's profile Send private message Visit poster's website
mecej4



Joined: 31 Oct 2006
Posts: 1885

PostPosted: Sat Mar 18, 2017 1:27 am    Post subject: Reply with quote

The following simplified version of the code also shows the error.

Code:
program wbug
implicit none
character :: ft = char(1)
integer k
k = ichar(ft) / 64
print *,k
end


Compile with ftn95 /defint_kind 2 /check. Outputs 520.

Works correctly if /64 is added.


Last edited by mecej4 on Sat Mar 18, 2017 12:55 pm; edited 1 time in total
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Sat Mar 18, 2017 8:24 am    Post subject: Reply with quote

Thank you. I have made a note of this.
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Wed Mar 22, 2017 7:59 am    Post subject: Reply with quote

This has now been fixed for the next release of FTN95.
Back to top
View user's profile Send private message AIM Address
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Tue Apr 11, 2017 4:17 am    Post subject: Reply with quote

Any idea when that might be?

I found another occurrence of this same kind of error, this time with the divisor of 16. If I declare a variable "SIXTEEN" and assign it the appropriate value, the all works fine.

Making me very nervous about my literal division of INT*4's with constants of a power of 2.
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Tue Apr 11, 2017 7:14 am    Post subject: Reply with quote

As I recall, the problem only occurs when setting the default integer type to 2. For me that is not a good idea. There is rarely a need to minimise the amount of store in this way and (because this option is rarely used) there is a higher risk of being the first to discover a bug.

We don't have a planned date for the next release of FTN95 at the moment. It's not long since the last release but on the other hand significant improvements have been added in the mean time.
Back to top
View user's profile Send private message AIM Address
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Tue Apr 11, 2017 3:02 pm    Post subject: Reply with quote

Thanks, Paul. Was curious because I am transitioning over to the default being 32-bit integers, but have hesitated to do a release to my testers if there is a new version just over the horizon!

I'll finish my transition, and await the new compiler with its fixes and features!

Bill
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group