mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-22 04:29:29 +02:00
* fixed bug that caused 'c in ['a'..'z']' to fail on the WebAssembly target, when code is compiled with {$packset 1}
This commit is contained in:
parent
2c622e2fe6
commit
a8b4c0772c
@ -474,7 +474,12 @@ implementation
|
||||
{ allocate a register for the result }
|
||||
location.register := hlcg.getintregister(current_asmdata.CurrAsmList, uopdef);
|
||||
|
||||
if right.location.loc=LOC_CONSTANT then
|
||||
if (right.location.loc=LOC_CONSTANT) and
|
||||
(opsize < OS_S8) and { = if unsigned }
|
||||
(((left.resultdef.typ=orddef) and
|
||||
(torddef(left.resultdef).low >= int64(tsetdef(right.resultdef).setbase))) or
|
||||
((left.resultdef.typ=enumdef) and
|
||||
(tenumdef(left.resultdef).min >= aint(tsetdef(right.resultdef).setbase)))) then
|
||||
begin
|
||||
{ can it actually occur currently? CEC }
|
||||
{ yes: "if bytevar in [1,3,5,7,9,11,13,15]" (JM) }
|
||||
|
33
tests/test/tset8.pp
Normal file
33
tests/test/tset8.pp
Normal file
@ -0,0 +1,33 @@
|
||||
program tset8;
|
||||
|
||||
{$packset 1}
|
||||
|
||||
procedure CheckIn(C: Char);
|
||||
begin
|
||||
if (C < 'a') or (C > 'z') then
|
||||
begin
|
||||
Writeln('Error!');
|
||||
Halt(1);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure CheckOut(C: Char);
|
||||
begin
|
||||
if (C >= 'a') and (C <= 'z') then
|
||||
begin
|
||||
Writeln('Error!');
|
||||
Halt(1);
|
||||
end;
|
||||
end;
|
||||
|
||||
var
|
||||
C: Char;
|
||||
begin
|
||||
for C := #0 to #255 do
|
||||
begin
|
||||
if C in ['a'..'z'] then
|
||||
CheckIn(C)
|
||||
else
|
||||
CheckOut(C);
|
||||
end;
|
||||
end.
|
Loading…
Reference in New Issue
Block a user