Peter Vreman wrote:

Gerhard Scholz wrote:
The check for overflow is obviously implemented different in 2.0.0 and
2.1.1
I'm not sure, at least

.L9:
    movw %dx,-12(%ebp)
.Ll3:
suggests that the target is not an integer, but instead is a (possibly
unsigned) word type. Please check again!

A solution would be to replace that line by:
   d := integer(Ord(a))-Ord(b)

It seems that the compiler now sees a "ord(c)" to be a BYTE, and BYTE -
BYTE
shall give a BYTE, and -1 is not in the range allowed for a BYTE.
Differences always should be interpreted as signed values, the error
message IMO comes from the final assignment.

What with cardinal-cardinal and pointer-cardinal or pointer-byte? Those
can't be represented by a longint (the native singed type of pascal). In
2.0.0 the those were converted to int64 values, but users were complaining
about the warnings that were generated.

For that matter Integer-Integer can't (in general) be represented by an Integer, which I suppose is why we have range checks. The documenation I can find is a little vague as to what the general result of +/- operations should be - it just seems to say integer which suggests that a difference between ordinals should be signed. (I think pointers are a slightly different case)

Colin

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to