Pārlūkot izejas kodu

--- Merging r32602 into '.':
A tests/webtbs/tw28713b.pp
A tests/webtbs/tw28713.pp
U compiler/nmem.pas
--- Recording mergeinfo for merge of r32602 into '.':
U .
--- Merging r33195 into '.':
G compiler/nmem.pas
--- Recording mergeinfo for merge of r33195 into '.':

git-svn-id: branches/fixes_3_0@34053 -

Jonas Maebe 9 gadi atpakaļ
vecāks
revīzija
25695174d0
3 mainītis faili ar 63 papildinājumiem un 0 dzēšanām
  1. 2 0
      .gitattributes
  2. 30 0
      tests/webtbs/tw28713.pp
  3. 31 0
      tests/webtbs/tw28713b.pp

+ 2 - 0
.gitattributes

@@ -14546,6 +14546,8 @@ tests/webtbs/tw2865.pp svneol=native#text/plain
 tests/webtbs/tw28650.pp svneol=native#text/pascal
 tests/webtbs/tw28674.pp svneol=native#text/pascal
 tests/webtbs/tw28702.pp svneol=native#text/plain
+tests/webtbs/tw28713.pp svneol=native#text/pascal
+tests/webtbs/tw28713b.pp svneol=native#text/pascal
 tests/webtbs/tw28718a.pp svneol=native#text/plain
 tests/webtbs/tw28718b.pp svneol=native#text/plain
 tests/webtbs/tw28718c.pp svneol=native#text/plain

+ 30 - 0
tests/webtbs/tw28713.pp

@@ -0,0 +1,30 @@
+{ %OPT=-O3 }
+// Compiled with option -O3 for Win32-I386
+
+type
+  PWordArray = ^TWordArray;
+  TWordArray = array [0..1023]of Word;
+
+  WordRec = packed record
+    LoByte,HiByte:Byte
+  end;
+
+var
+  Buffer:TWordArray;
+  OldMousePos:LongInt = 0;
+  ScreenBuffer:Pointer = @Buffer;
+
+procedure Show(ScreenBuffer:Pointer);
+begin
+  WordRec(PWordArray(ScreenBuffer)^[OldMousePos]).HiByte:=(not
+  WordRec(PWordArray(ScreenBuffer)^[OldMousePos]).HiByte)and $7F
+  // he forgets to write the result into the array
+end;
+
+begin
+  Buffer[0]:=$0000;
+  Show(ScreenBuffer);
+  if Buffer[0]<>$7F00 then
+    halt(1);
+  writeln('ok');
+end.

+ 31 - 0
tests/webtbs/tw28713b.pp

@@ -0,0 +1,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.