Comparision Cardinal/Integer Bug?
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 -- Frank Heckenbach, frank@g-n-u.de, http://fjf.gnu.de/, 7977168E GPC To-Do list, latest features, fixed bugs: http://www.gnu-pascal.de/todo.html
participants (2)
-
Eike Lange -
Frank Heckenbach