* fixed bug in ppc jumptable generation for case statements with

negative cases caused by wrong automatic type conversion from
    longint to unsigned tconstexprint (+ test for such jump tables)
  * fixed darwin/ppc64 jumptables in case of jmptablenorange

git-svn-id: trunk@8311 -
This commit is contained in:
Jonas Maebe 2007-08-26 11:15:14 +00:00
parent 5fbf90b1e3
commit 0bfce99477
3 changed files with 49 additions and 6 deletions

1
.gitattributes vendored
View File

@ -6548,6 +6548,7 @@ tests/test/cg/tcalvar7.pp svneol=native#text/plain
tests/test/cg/tcalvar8.pp svneol=native#text/plain
tests/test/cg/tcalvar9.pp svneol=native#text/plain
tests/test/cg/tcase.pp svneol=native#text/plain
tests/test/cg/tcase2.pp svneol=native#text/plain
tests/test/cg/tclacla1.pp svneol=native#text/plain
tests/test/cg/tclasize.pp svneol=native#text/plain
tests/test/cg/tclatype.pp svneol=native#text/plain

View File

@ -79,28 +79,28 @@ implementation
procedure genitem(list:TAsmList;t : pcaselabel);
var
i : aint;
i : TConstExprInt;
begin
if assigned(t^.less) then
genitem(list,t^.less);
{ fill possible hole }
i:=last.svalue+1;
i:=last+1;
while i<=t^._low-1 do
begin
if (target_info.system<>system_powerpc64_darwin) then
list.concat(Tai_const.Create_sym(elselabel))
else
list.concat(Tai_const.Create_rel_sym(aitconst_32bit,table,elselabel));
inc(i);
i:=i+1;
end;
i:=t^._low.svalue;
i:=t^._low;
while i<=t^._high do
begin
if (target_info.system<>system_powerpc64_darwin) then
list.concat(Tai_const.Create_sym(blocklabel(t^.blockid)))
else
list.concat(Tai_const.Create_rel_sym(aitconst_32bit,table,blocklabel(t^.blockid)));
inc(i);
i:=i+1;
end;
last:=t^._high;
if assigned(t^.greater) then
@ -131,7 +131,7 @@ implementation
else
mulfactor:=4;
cg.a_op_const_reg(current_asmdata.CurrAsmList, OP_MUL, OS_INT, mulfactor, indexreg);
reference_reset_symbol(href, table, (-aint(min_)) * tcgsize2size[OS_ADDR]);
reference_reset_symbol(href, table, (-aint(min_)) * mulfactor);
if (target_info.system<>system_powerpc64_darwin) then
begin

42
tests/test/cg/tcase2.pp Normal file
View File

@ -0,0 +1,42 @@
const
maxsmallint = high(smallint);
{ error codes }
grOk = 0;
grNoInitGraph = -1;
grNotDetected = -2;
grFileNotFound = -3;
grInvalidDriver = -4;
grNoLoadMem = -5;
grNoScanMem = -6;
grNoFloodMem = -7;
grFontNotFound = -8;
grNoFontMem = -9;
grInvalidMode = -10;
grError = -11;
grIOerror = -12;
grInvalidFont = -13;
grInvalidFontNum = -14;
grInvalidVersion = -18;
function GraphErrorMsg(ErrorCode: smallint): string;
Begin
GraphErrorMsg:='';
case ErrorCode of
grOk,grFileNotFound,grInvalidDriver: exit;
grNoInitGraph: GraphErrorMsg:='Graphics driver not installed';
grNotDetected: GraphErrorMsg:='Graphics hardware not detected';
grNoLoadMem,grNoScanMem,grNoFloodMem: GraphErrorMsg := 'Not enough memory for graphics';
grNoFontMem: GraphErrorMsg := 'Not enough memory to load font';
grFontNotFound: GraphErrorMsg:= 'Font file not found';
grInvalidMode: GraphErrorMsg := 'Invalid graphics mode';
grError: GraphErrorMsg:='Graphics error';
grIoError: GraphErrorMsg:='Graphics I/O error';
grInvalidFont,grInvalidFontNum: GraphErrorMsg := 'Invalid font';
grInvalidVersion: GraphErrorMsg:='Invalid driver version';
end;
end;
begin
if GraphErrorMsg(grNoInitGraph) <> 'Graphics driver not installed' then
halt(1);
end.