replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - integer*1 range problems
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 

integer*1 range problems

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



Joined: 04 Nov 2005
Posts: 165
Location: Darkest Devon

PostPosted: Mon Jun 30, 2008 3:37 pm    Post subject: integer*1 range problems Reply with quote

On v 5.21, yhe following generates a "reference to undefined variable" error at the print when using a checkmate build. A breakpoint set on the print shows i1 as "undefined":

integer*1:: i1
i1 = 0
i1 = ibset(i1, 7)
print *, i1

When running a debug build i1 is still shown as undefined in the debugger, but the program doesn't stop and prints the correct -128.

The problem doesn't seem to occur when setting the top bit on an integer*2 or *3.
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Tue Jul 01, 2008 10:15 am    Post subject: Reply with quote

Thank you for the bug report.
We will investigate this as soon as we can.
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


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

PostPosted: Fri Jul 18, 2008 4:02 pm    Post subject: Reply with quote

inset(i1, 7) gives Z'80' which is 128 and is out of range.

It also happens to be the "undefined" state used by FTN95 for INTEGER*1 variables.
Back to top
View user's profile Send private message AIM Address
acw



Joined: 04 Nov 2005
Posts: 165
Location: Darkest Devon

PostPosted: Mon Jul 21, 2008 6:17 pm    Post subject: Reply with quote

Erm, I've alway known Z'80' in a signed 8-bit integer to be -128 - a single signed byte's range being -128 to +127. The ftn95 help under "Arithmetic overflow checking" also has this for INTEGER(KIND=1). I can see how you might argue that ibset is casting from a >8 bit integer in which case it would be out of range (although I'd argue that is not correct since all I want to do is set bit 7 of the variable and I shouldn't need to consider what's going on within ibset) - wouldn't that then generate an overflow ?

I do buy the "undefined" explanation for checkmate build however, and that does explain the checkmate problem, however I don't see that the debugger has a problem with it in my debug builds as I don't have /undef enabled in (I can't use undefined variable checks as my program processes binary data - which is a pity).
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Mon Jul 21, 2008 6:31 pm    Post subject: Reply with quote

What I should have said was that the assignment i1 = Z'80' where i1 is INTEGER*1, is flagged by the compiler as out of range because the default integer size on the RHS is INTEGER*4. So the RHS is 128 and the assignment is out of range.

I will take another look at it and report back.
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


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

PostPosted: Fri Jul 25, 2008 7:55 pm    Post subject: Reply with quote

This bug/limitation has be removed for the next release.
Back to top
View user's profile Send private message AIM Address
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