mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 15:49:26 +02:00
* 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:
parent
d27673bbe4
commit
e13a708002
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -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
|
||||
|
@ -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
10
tests/test/tparray26.pp
Normal 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.
|
Loading…
Reference in New Issue
Block a user