Hi Folks!
I don't know whether it's a feature or a bug, I didn't find it on the list of known bugs so here is my report: Comparisions between Cardinal and Integer may fail, if the Integer value is negative.
Version: 2.1 (20020510), based on gcc-2.95.2 19991024 (release)
program testcase;
var aCard: Cardinal; aInt: Integer;
begin aCard := 1; aInt := -1;
{ "FAIL" } if (aCard > aInt) then WriteLn ('OK') else WriteLn ('FAIL');
{ "FAIL" } if (aCard > -1) then WriteLn ('OK') else WriteLn ('FAIL');
{ just for completness: "OK" } if (1 > -1) then WriteLn ('OK') else WriteLn ('FAIL') end.
BTW: The gcc C fontend does the same.
Eike
Eike Lange wrote:
I don't know whether it's a feature or a bug, I didn't find it on the list of known bugs so here is my report: Comparisions between Cardinal and Integer may fail, if the Integer value is negative.
BTW: The gcc C fontend does the same.
I hope I've fixed this now (eike2.pas). I'll upload a new patch soon, so you can test it.
Frank