[fpc-devel]Corrected, but is still a bug in Compiler: Bug 1222 continued ...
Jonas Maebe
jonas at zeus.rug.ac.be
Wed Dec 20 17:44:01 CET 2000
>> >compiled with snapshot ppc386 go32v2 ver 1.1 [2000/12/16]
>> >asm source and comments see below
>>
>> It already works correctly with today's snapshot because of some fixes I
>> did recently.
>
>Did you implement the cardinal <-> longint thing i proposed?
No. That doesn't have anything to do with this bug either, because both
the constant and the variable are a cardinal here... The problem was
twofold I think (the problem that symbolic constants weren't kept in
32bits if they were a cardinal and that only recently I finally replaced
all helper routines for case with functions that return int64 values
instead of longints).
For the others: Peter suggested that automatic typeconversions be done
for cardinal constants (ie. constants in the range int64($80000000) and
int64($ffffffff)) to longint because otherwise you need longint typecasts
when using such constants as longints (at least when you have range
checking turned on, otherwise you still get annoying warnings).
A problem I see with this is that you would at least have to
defferentiate between hex/binary and decimal constants, because otherwise
the following would become legal (no range check error/warning)
{$r+}
const
maxcardinal = 4294967295;
var
l: longint;
begin
l := maxcardinal;
end.
It is certainly possible to do such a detection, but I'm not so sure
whether it's desirable...
Jonas
More information about the fpc-devel
mailing list