mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 13:29:14 +02:00
* fixed bug in typed constant record parsing with variant records
in case a variant part other than the first is initialised (the index of the next symbol was not adjusted, causing incorrect error messages in case there are some alignment bits/bytes between the previous and next field) git-svn-id: trunk@8948 -
This commit is contained in:
parent
c1cbd8a949
commit
368cd52f97
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -7031,6 +7031,7 @@ tests/test/tprec18.pp svneol=native#text/plain
|
|||||||
tests/test/tprec19.pp svneol=native#text/plain
|
tests/test/tprec19.pp svneol=native#text/plain
|
||||||
tests/test/tprec2.pp svneol=native#text/plain
|
tests/test/tprec2.pp svneol=native#text/plain
|
||||||
tests/test/tprec20.pp svneol=native#text/plain
|
tests/test/tprec20.pp svneol=native#text/plain
|
||||||
|
tests/test/tprec21.pp svneol=native#text/plain
|
||||||
tests/test/tprec3.pp svneol=native#text/plain
|
tests/test/tprec3.pp svneol=native#text/plain
|
||||||
tests/test/tprec4.pp svneol=native#text/plain
|
tests/test/tprec4.pp svneol=native#text/plain
|
||||||
tests/test/tprec5.pp svneol=native#text/plain
|
tests/test/tprec5.pp svneol=native#text/plain
|
||||||
|
@ -1052,7 +1052,10 @@ implementation
|
|||||||
{ end; }
|
{ end; }
|
||||||
{ const r: tr = (w1:1;w2:1;l2:5); }
|
{ const r: tr = (w1:1;w2:1;l2:5); }
|
||||||
(tfieldvarsym(recsym).fieldoffset = curroffset) then
|
(tfieldvarsym(recsym).fieldoffset = curroffset) then
|
||||||
srsym := recsym
|
begin
|
||||||
|
srsym := recsym;
|
||||||
|
symidx := def.symtable.SymList.indexof(srsym)
|
||||||
|
end
|
||||||
{ going backwards isn't allowed in any mode }
|
{ going backwards isn't allowed in any mode }
|
||||||
else if (tfieldvarsym(recsym).fieldoffset<curroffset) then
|
else if (tfieldvarsym(recsym).fieldoffset<curroffset) then
|
||||||
begin
|
begin
|
||||||
@ -1136,7 +1139,7 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{ are there any fields left, but don't complain if there only
|
{ are there any fields left, but don't complain if there only
|
||||||
come other variant partsa fter the last initialized field }
|
come other variant parts after the last initialized field }
|
||||||
if assigned(srsym) and
|
if assigned(srsym) and
|
||||||
(
|
(
|
||||||
(recsym=nil) or
|
(recsym=nil) or
|
||||||
|
52
tests/test/tprec21.pp
Normal file
52
tests/test/tprec21.pp
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
const
|
||||||
|
RS_CR = $00;
|
||||||
|
RS_CR0 = $01;
|
||||||
|
RS_CR1 = $02;
|
||||||
|
RS_CR2 = $03;
|
||||||
|
RS_CR3 = $04;
|
||||||
|
RS_CR4 = $05;
|
||||||
|
RS_CR5 = $06;
|
||||||
|
RS_CR6 = $07;
|
||||||
|
RS_CR7 = $08;
|
||||||
|
|
||||||
|
type
|
||||||
|
TAsmCondFlag = (C_None { unconditional jumps },
|
||||||
|
{ conditions when not using ctr decrement etc }
|
||||||
|
C_LT,C_LE,C_EQ,C_GE,C_GT,C_NL,C_NE,C_NG,C_SO,C_NS,C_UN,C_NU,
|
||||||
|
{ conditions when using ctr decrement etc }
|
||||||
|
C_T,C_F,C_DNZ,C_DNZT,C_DNZF,C_DZ,C_DZT,C_DZF);
|
||||||
|
|
||||||
|
TDirHint = (DH_None,DH_Minus,DH_Plus);
|
||||||
|
|
||||||
|
type
|
||||||
|
TAsmCond = bitpacked record
|
||||||
|
dirhint : tdirhint;
|
||||||
|
case simple: boolean of
|
||||||
|
false: (BO, BI: 0..31);
|
||||||
|
true: (
|
||||||
|
cond: TAsmCondFlag;
|
||||||
|
case byte of
|
||||||
|
0: ();
|
||||||
|
{ specifies in which part of the cr the bit has to be }
|
||||||
|
{ tested for blt,bgt,beq,..,bnu }
|
||||||
|
1: (cr: RS_CR0..RS_CR7);
|
||||||
|
{ specifies the bit to test for bt,bf,bdz,..,bdzf }
|
||||||
|
2: (crbit: 0..31)
|
||||||
|
);
|
||||||
|
end;
|
||||||
|
|
||||||
|
const
|
||||||
|
zerocond: tasmcond = (dirhint: DH_Plus;
|
||||||
|
simple: true;
|
||||||
|
cond:C_NE;
|
||||||
|
cr: RS_CR1);
|
||||||
|
|
||||||
|
|
||||||
|
begin
|
||||||
|
with zerocond do
|
||||||
|
if (dirhint <> DH_Plus) or
|
||||||
|
not simple or
|
||||||
|
(cond <> C_NE) or
|
||||||
|
(cr <> RS_CR1) then
|
||||||
|
halt(1);
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user