mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-15 18:49:19 +02:00
* fixed check regarding whether a field is in the first or second word of
of 2*sizeof(aword) bitpacked record that's kept in registers (mantis #29669) git-svn-id: trunk@33177 -
This commit is contained in:
parent
3ee5661ff1
commit
9788bb1316
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -14968,6 +14968,7 @@ tests/webtbs/tw2958.pp svneol=native#text/plain
|
|||||||
tests/webtbs/tw29585.pp svneol=native#text/plain
|
tests/webtbs/tw29585.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw29609.pp svneol=native#text/pascal
|
tests/webtbs/tw29609.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw2966.pp svneol=native#text/plain
|
tests/webtbs/tw2966.pp svneol=native#text/plain
|
||||||
|
tests/webtbs/tw29669.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2975.pp svneol=native#text/plain
|
tests/webtbs/tw2975.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2976.pp svneol=native#text/plain
|
tests/webtbs/tw2976.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2983.pp svneol=native#text/plain
|
tests/webtbs/tw2983.pp svneol=native#text/plain
|
||||||
|
@ -325,6 +325,7 @@ implementation
|
|||||||
paraloc1 : tcgpara;
|
paraloc1 : tcgpara;
|
||||||
tmpref: treference;
|
tmpref: treference;
|
||||||
sref: tsubsetreference;
|
sref: tsubsetreference;
|
||||||
|
awordoffset,
|
||||||
offsetcorrection : aint;
|
offsetcorrection : aint;
|
||||||
pd : tprocdef;
|
pd : tprocdef;
|
||||||
sym : tsym;
|
sym : tsym;
|
||||||
@ -451,13 +452,18 @@ implementation
|
|||||||
offsetcorrection:=0;
|
offsetcorrection:=0;
|
||||||
if (left.location.size in [OS_PAIR,OS_SPAIR]) then
|
if (left.location.size in [OS_PAIR,OS_SPAIR]) then
|
||||||
begin
|
begin
|
||||||
if (vs.fieldoffset>=sizeof(aword)) xor (target_info.endian=endian_big) then
|
if not is_packed_record_or_object(left.resultdef) then
|
||||||
|
awordoffset:=sizeof(aword)
|
||||||
|
else
|
||||||
|
awordoffset:=sizeof(aword)*8;
|
||||||
|
|
||||||
|
if (vs.fieldoffset>=awordoffset) xor (target_info.endian=endian_big) then
|
||||||
location.sreg.subsetreg := left.location.registerhi
|
location.sreg.subsetreg := left.location.registerhi
|
||||||
else
|
else
|
||||||
location.sreg.subsetreg := left.location.register;
|
location.sreg.subsetreg := left.location.register;
|
||||||
|
|
||||||
if (vs.fieldoffset>=sizeof(aword)) then
|
if vs.fieldoffset>=awordoffset then
|
||||||
offsetcorrection:=sizeof(aword)*8;
|
offsetcorrection := sizeof(aword)*8;
|
||||||
|
|
||||||
location.sreg.subsetregsize := OS_INT;
|
location.sreg.subsetregsize := OS_INT;
|
||||||
end
|
end
|
||||||
|
52
tests/webtbs/tw29669.pp
Normal file
52
tests/webtbs/tw29669.pp
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
{$mode objfpc}
|
||||||
|
|
||||||
|
program Project1;
|
||||||
|
|
||||||
|
uses
|
||||||
|
SysUtils;
|
||||||
|
|
||||||
|
type
|
||||||
|
TPackedIdLevel1 = 0..255;
|
||||||
|
TPackedIdLevel2 = 0..65535;
|
||||||
|
TPackedIdLevel3 = 0..65535;
|
||||||
|
TPackedIdLevel4 = 0..65535;
|
||||||
|
TPackedIdLevel5 = 0..255;
|
||||||
|
|
||||||
|
TPackedId = bitpacked record
|
||||||
|
clusterId : TPackedIdLevel5;
|
||||||
|
agentId : TPackedIdLevel4;
|
||||||
|
dataSourceId : TPackedIdLevel3;
|
||||||
|
deviceId : TPackedIdLevel2;
|
||||||
|
esmId : TPackedIdLevel1;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function PackedIdToStr(const ipsid : qword) : string;
|
||||||
|
begin
|
||||||
|
result := IntToStr(TPackedId(ipsid).esmId) + '-' +
|
||||||
|
IntToStr(TPackedId(ipsid).deviceId) + '-' +
|
||||||
|
IntToStr(TPackedId(ipsid).dataSourceId) + '-' +
|
||||||
|
IntToStr(TPackedId(ipsid).agentId) + '-' +
|
||||||
|
IntToStr(TPackedId(ipsid).clusterId);
|
||||||
|
if TPackedId(ipsid).clusterid<>123 then
|
||||||
|
halt(1);
|
||||||
|
if TPackedId(ipsid).agentid<>45678 then
|
||||||
|
halt(2);
|
||||||
|
if TPackedId(ipsid).datasourceid<>9012 then
|
||||||
|
halt(3);
|
||||||
|
if TPackedId(ipsid).deviceid<>34567 then
|
||||||
|
halt(4);
|
||||||
|
if TPackedId(ipsid).esmid<>89 then
|
||||||
|
halt(5);
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
pi: TPackedId;
|
||||||
|
begin
|
||||||
|
pi.clusterid:=123;
|
||||||
|
pi.agentid:=45678;
|
||||||
|
pi.datasourceid:=9012;
|
||||||
|
pi.deviceid:=34567;
|
||||||
|
pi.esmid:=89;
|
||||||
|
writeln(PackedIdToStr(qword(pi)));
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user