mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 21:49:06 +02:00
* fixed check for bitpacked accesses (mantis #24007)
git-svn-id: trunk@23705 -
This commit is contained in:
parent
eeae77bfc2
commit
3cde2b2d84
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -13239,6 +13239,7 @@ tests/webtbs/tw2382.pp svneol=native#text/plain
|
|||||||
tests/webtbs/tw2388.pp svneol=native#text/plain
|
tests/webtbs/tw2388.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw23962.pp svneol=native#text/plain
|
tests/webtbs/tw23962.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2397.pp svneol=native#text/plain
|
tests/webtbs/tw2397.pp svneol=native#text/plain
|
||||||
|
tests/webtbs/tw24007.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2409.pp svneol=native#text/plain
|
tests/webtbs/tw2409.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2421.pp svneol=native#text/plain
|
tests/webtbs/tw2421.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2423.pp svneol=native#text/plain
|
tests/webtbs/tw2423.pp svneol=native#text/plain
|
||||||
|
@ -1029,7 +1029,8 @@ implementation
|
|||||||
{ only orddefs and enumdefs are actually bitpacked. Don't consider
|
{ only orddefs and enumdefs are actually bitpacked. Don't consider
|
||||||
e.g. an access to a 3-byte record as "bitpacked", since it
|
e.g. an access to a 3-byte record as "bitpacked", since it
|
||||||
isn't }
|
isn't }
|
||||||
(tvecnode(n).left.resultdef.typ in [orddef,enumdef]) and
|
(tvecnode(n).left.resultdef.typ = arraydef) and
|
||||||
|
(tarraydef(tvecnode(n).left.resultdef).elementdef.typ in [orddef,enumdef]) and
|
||||||
not(tarraydef(tvecnode(n).left.resultdef).elepackedbitsize in [8,16,32,64]);
|
not(tarraydef(tvecnode(n).left.resultdef).elepackedbitsize in [8,16,32,64]);
|
||||||
subscriptn:
|
subscriptn:
|
||||||
result:=
|
result:=
|
||||||
|
21
tests/webtbs/tw24007.pp
Normal file
21
tests/webtbs/tw24007.pp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
var
|
||||||
|
str: bitpacked array [1..6] of 'a'..'z';
|
||||||
|
i: integer;
|
||||||
|
ch: char;
|
||||||
|
error: boolean;
|
||||||
|
begin
|
||||||
|
error := false;
|
||||||
|
for i := 1 to 6 do str[i] := chr(ord('a')+i-1);
|
||||||
|
|
||||||
|
for i := 1 to 6 do begin
|
||||||
|
write('str[i] = ''', str[i], '''; ord(str[2]) = ',ord(str[i]));
|
||||||
|
ch:=str[i]; {if we had used directly str[i] in the expression below, the correct value would have been read}
|
||||||
|
if ch <> chr(ord(str[i])) then
|
||||||
|
begin
|
||||||
|
write(' ==> Bug: chr(',ord(ch),') read, excpected chr(',ord('a')+i-1,')');
|
||||||
|
error:=true;
|
||||||
|
end;
|
||||||
|
writeln;
|
||||||
|
end;
|
||||||
|
halt(ord(error));
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user