When trying the following
i1SetMask=b'11111111'
i2SetMask=b'1111111111111111'
I get the error 'constant out of range' with v5.01.0 but v4.9.0 and earlier seem to work ok
Welcome to our forums
When trying the following
i1SetMask=b'11111111'
i2SetMask=b'1111111111111111'
I get the error 'constant out of range' with v5.01.0 but v4.9.0 and earlier seem to work ok
I have tested your code fragment using FTN95 v5.10 (the current release) and it does not show any errors.
I do not have immediate access to a copy of version 5.01 so I do not know if there is a problem with this version. I cannot think of any changes to FTN95 that would be relevant. You can upgrade to 5.10 but before doing so I suggest that you test the fragment using your copy of version 5.01. It is possible that something else in the original program is causing the problem.
Paul
Thanks - I will try it in a separate program
Regards
Mark Jordan
I've had that as well in the latest version of FTN95.
If it is Integer*2, then 16 binary digits is the limit, and the value you are trying to enter is actually -1, 1111111111111111 being the twos complement representation. try i2SetMask= -1
Regards
Paul
Program Fred INTEGER*1 i1Mask i1Mask=b'11111111' END
fails with the error constant out of range
so I followed Ian's suggestion
! i1SetMask=b'11111111' ! i2SetMask=b'1111111111111111' i1SetMask=-1 i2SetMask=-1 i4SetMask=b'11111111111111111111111111111111' ! i4BytePt=ISHFT(i4BitPt, -3) ! Divide by 8 i4BitOffset=i4BitPt-ISHFT(i4BytePt, 3) ! Multiply by 8 i4BitSize= i4NumBits+i4BitOffset ! IF (i4BitSize.LT.8) THEN i1RightShift=(8-i4NumBits) ! How many bits to remove
it avoids the constant out of range error but it now fails on Operand incompatible with opcode on the line i1RightShift=(8-i4NumBits)
😦
As I said all this worked ok with 4.9
Regards
Mark
Mark,
What are you trying to do with this code?
Ian
A range check for INTEGER1 and INTEGER2 was introduced for /CHECK (and options that include /CHECK) at version 5.0 of FTN95.
You can avoid the problem by using constants of the required integer KIND.
i1SetMask=b'11111111'_1 i2SetMask=b'1111111111111111'_2
Then the conversion from default integer KIND does not take place and the range check is avoided.