mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-06 17:08:01 +02:00
* fixed calculation of offset of constant indexing of bitpacked arrays of
non-ordinal types (mantis #9174) git-svn-id: trunk@7847 -
This commit is contained in:
parent
75af9f2a4d
commit
b99c1e9fed
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -8320,6 +8320,7 @@ tests/webtbs/tw9128.pp svneol=native#text/plain
|
||||
tests/webtbs/tw9139.pp svneol=native#text/plain
|
||||
tests/webtbs/tw9139a.pp svneol=native#text/plain
|
||||
tests/webtbs/tw9167.pp svneol=native#text/plain
|
||||
tests/webtbs/tw9174.pp svneol=native#text/plain
|
||||
tests/webtbs/ub1873.pp svneol=native#text/plain
|
||||
tests/webtbs/ub1883.pp svneol=native#text/plain
|
||||
tests/webtbs/uw0555.pp svneol=native#text/plain
|
||||
|
@ -709,7 +709,9 @@ implementation
|
||||
not(is_dynamic_array(left.resultdef)) and
|
||||
(not(is_packed_array(left.resultdef)) or
|
||||
((mulsize mod 8 = 0) and
|
||||
ispowerof2(mulsize div 8,temp))) then
|
||||
ispowerof2(mulsize div 8,temp)) or
|
||||
{ only orddefs are bitpacked }
|
||||
not is_ordinal(resultdef)) then
|
||||
dec(location.reference.offset,bytemulsize*tarraydef(left.resultdef).lowrange);
|
||||
|
||||
if right.nodetype=ordconstn then
|
||||
|
56
tests/webtbs/tw9174.pp
Normal file
56
tests/webtbs/tw9174.pp
Normal file
@ -0,0 +1,56 @@
|
||||
{$mode macpas}
|
||||
|
||||
program packed_offset_bug;
|
||||
|
||||
type
|
||||
SInt16 = integer;
|
||||
Point = record
|
||||
case SInt16 of
|
||||
0: (
|
||||
v: SInt16;
|
||||
h: SInt16;
|
||||
);
|
||||
1: (
|
||||
vh: array [0..1] of SInt16;
|
||||
);
|
||||
end;
|
||||
PointPtr = ^Point;
|
||||
Rect = record
|
||||
case SInt16 of
|
||||
0: (
|
||||
top: SInt16;
|
||||
left: SInt16;
|
||||
bottom: SInt16;
|
||||
right: SInt16;
|
||||
);
|
||||
1: (
|
||||
topLeft: Point;
|
||||
botRight: Point;
|
||||
);
|
||||
end;
|
||||
RectPtr = ^Rect;
|
||||
|
||||
var
|
||||
gMeasStrs: packed array[1..64] of string[4];
|
||||
gMeasStrRects: array[1..64] of Rect;
|
||||
|
||||
var
|
||||
i,j,k: longint;
|
||||
begin
|
||||
writeln( 'SizeOf gMeasStrs) = ', SizeOf( gMeasStrs));
|
||||
writeln( 'SizeOf gMeasStrRects) = ', SizeOf( gMeasStrRects));
|
||||
writeln( 'Offset gMeasStrs[ 1 ] = ', ptruint( @gMeasStrs[ 1]) -ptruint( @gMeasStrs));
|
||||
writeln( 'Offset gMeasStrs[ 64, 4] = ', ptruint( @gMeasStrs[ 64, 4]) - ptruint( @gMeasStrs));
|
||||
writeln( 'Offset gMeasStrRects = ', ptruint( @gMeasStrRects) - ptruint( @gMeasStrs));
|
||||
i:=1;
|
||||
j:=64;
|
||||
k:=4;
|
||||
if (SizeOf( gMeasStrs) <> 320) or
|
||||
(SizeOf( gMeasStrRects) <> 512) or
|
||||
(ptruint( @gMeasStrs[ 1]) - ptruint( @gMeasStrs) <> 0) or
|
||||
(ptruint( @gMeasStrs[ 64, 4])- ptruint( @gMeasStrs)<>319) or
|
||||
(ptruint( @gMeasStrs[ i]) - ptruint( @gMeasStrs) <> 0) or
|
||||
(ptruint( @gMeasStrs[ j, k])- ptruint( @gMeasStrs)<>319) then
|
||||
halt(1);
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user