summaryrefslogtreecommitdiff
path: root/tests/webtbs/tw28713b.pp
blob: 4a55072b2ca4af9b0c88083fc9ee37c1c5ac578e (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
30
31
{ %OPT=-O3 }
{$mode objfpc}
// Compiled with option -O3 for Win32-I386

type
  PWordArray = ^TWordArray;
  TWordArray = array [0..1023]of LongWord;

  TMyclass = class
    LoByte,HiByte:Byte
  end;

var
  Buffer:TWordArray;
  OldMousePos:LongInt = 0;
  ScreenBuffer:Pointer = @Buffer;

procedure Show(ScreenBuffer:Pointer);
begin
  TMyClass(PWordArray(ScreenBuffer)^[OldMousePos]).HiByte:=(not
  TMyClass(PWordArray(ScreenBuffer)^[OldMousePos]).HiByte)and $7F
  // he forgets to write the result into the array
end;

begin
  TMyClass(Buffer[0]):=TMyClass.Create;
  Show(ScreenBuffer);
  if TMyClass(Buffer[0]).HiByte<>$7F then
    halt(1);
  writeln('ok');
end.