* fixed compiler crash when using a bitpacked array whose size was

close to high(longint) bytes

git-svn-id: trunk@13241 -
This commit is contained in:
Jonas Maebe 2009-06-06 12:33:18 +00:00
parent d27673bbe4
commit e13a708002
3 changed files with 14 additions and 3 deletions

1
.gitattributes vendored
View File

@ -8228,6 +8228,7 @@ tests/test/tparray22.pp svneol=native#text/plain
tests/test/tparray23.pp svneol=native#text/plain
tests/test/tparray24.pp svneol=native#text/plain
tests/test/tparray25.pp svneol=native#text/plain
tests/test/tparray26.pp svneol=native#text/plain
tests/test/tparray3.pp svneol=native#text/plain
tests/test/tparray4.pp svneol=native#text/plain
tests/test/tparray5.pp svneol=native#text/plain

View File

@ -2376,10 +2376,10 @@ implementation
exit;
end;
result:=cachedelesize*aint(cachedelecount);
if (ado_IsBitPacked in arrayoptions) then
size:=(cachedelesize * aint(cachedelecount) + 7) div 8
else
result:=cachedelesize*aint(cachedelecount);
{ can't just add 7 and divide by 8, because that may overflow }
result:=result div 8 + ord((result mod 8)<>0);
end;

10
tests/test/tparray26.pp Normal file
View File

@ -0,0 +1,10 @@
{ %norun }
type
ta = bitpacked array[0..high(longint)-1] of 0..1;
var
p: pointer;
begin
getmem(p,sizeof(ta));
ta(p^)[high(longint)-1]:=1;
end.