summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/webtbs/tw18082.pp
blob: e51a8ecb5dad8d1275221c8d68d8a1d39abfcd2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
var
  l: longint;
{$ifdef cpu64}
  i: int64;
{$endif}

begin
  l:=-123;
  if interlockedcompareexchange(l,-1,124)<>-123 then
    halt(1);
  if l<>-123 then
    halt(2);
  if interlockedcompareexchange(l,-1,-123)<>-123 then
    halt(3);
  if l<>-1 then
    halt(4);

{$ifdef cpu64}
  i:=-123;
  if interlockedcompareexchange64(i,-1,124)<>-123 then
    halt(5);
  if i<>-123 then
    halt(6);
  if interlockedcompareexchange64(i,-1,-123)<>-123 then
    halt(7);
  if i<>-1 then
    halt(8);
{$endif}
end.