* ensure that any Boolean type can be used for the Succeeded parameter and that there are no unitialized warnings

+ added test
This commit is contained in:
Sven/Sarah Barth 2024-12-13 21:45:36 +01:00
parent 6828da9c6c
commit 311c023271
2 changed files with 37 additions and 2 deletions

View File

@ -4284,8 +4284,9 @@ implementation
begin
{ the boolean parameter must be assignable }
valid_for_var(tcallparanode(tcallparanode(tcallparanode(tcallparanode(left).right).right).right).left,true);
set_varstate(tcallparanode(tcallparanode(tcallparanode(tcallparanode(left).right).right).right).left,vs_readwritten,[vsf_must_be_valid]);
inserttypeconv(tcallparanode(tcallparanode(tcallparanode(tcallparanode(left).right).right).right).left,pasbool1type);
set_varstate(tcallparanode(tcallparanode(tcallparanode(tcallparanode(left).right).right).right).left,vs_written,[]);
if not is_boolean(tcallparanode(tcallparanode(tcallparanode(tcallparanode(left).right).right).right).left.resultdef) then
inserttypeconv(tcallparanode(tcallparanode(tcallparanode(tcallparanode(left).right).right).right).left,pasbool1type);
end;
end;
end;

34
tests/test/tatomic8.pp Normal file
View File

@ -0,0 +1,34 @@
{ %NORUN }
program tatomic8;
{$mode objfpc}
procedure AvoidHint(aArg: array of Boolean);
begin
end;
var
l: LongInt;
b: Boolean;
bb: ByteBool;
wb: WordBool;
lb: LongBool;
qb: QWordBool;
b8: Boolean8;
b16: Boolean16;
b32: Boolean32;
b64: Boolean64;
begin
l := 0;
AtomicCmpExchange(l, 42, 84, b);
AtomicCmpExchange(l, 42, 84, bb);
AtomicCmpExchange(l, 42, 84, wb);
AtomicCmpExchange(l, 42, 84, lb);
AtomicCmpExchange(l, 42, 84, qb);
AtomicCmpExchange(l, 42, 84, b8);
AtomicCmpExchange(l, 42, 84, b16);
AtomicCmpExchange(l, 42, 84, b32);
AtomicCmpExchange(l, 42, 84, b64);
AvoidHint([b, bb, wb, lb, qb, b8, b16, b32, b64]);
end.