View previous topic :: View next topic |
Author |
Message |
wahorger
Joined: 13 Oct 2014 Posts: 1217 Location: Morrison, CO, USA
|
Posted: Sat Mar 18, 2017 12:31 am Post subject: Odd bug in CHECKMATE mode |
|
|
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 |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1888
|
Posted: Sat Mar 18, 2017 1:27 am Post subject: |
|
|
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 |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7931 Location: Salford, UK
|
Posted: Sat Mar 18, 2017 8:24 am Post subject: |
|
|
Thank you. I have made a note of this. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7931 Location: Salford, UK
|
Posted: Wed Mar 22, 2017 7:59 am Post subject: |
|
|
This has now been fixed for the next release of FTN95. |
|
Back to top |
|
|
wahorger
Joined: 13 Oct 2014 Posts: 1217 Location: Morrison, CO, USA
|
Posted: Tue Apr 11, 2017 4:17 am Post subject: |
|
|
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 |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7931 Location: Salford, UK
|
Posted: Tue Apr 11, 2017 7:14 am Post subject: |
|
|
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 |
|
|
wahorger
Joined: 13 Oct 2014 Posts: 1217 Location: Morrison, CO, USA
|
Posted: Tue Apr 11, 2017 3:02 pm Post subject: |
|
|
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 |
|
|
|