Kaynağa Gözat

+ added test (already works)

git-svn-id: trunk@7771 -
Jonas Maebe 18 yıl önce
ebeveyn
işleme
ba0d0d4bb8
2 değiştirilmiş dosya ile 50 ekleme ve 0 silme
  1. 1 0
      .gitattributes
  2. 49 0
      tests/webtbs/tw9128.pp

+ 1 - 0
.gitattributes

@@ -8308,6 +8308,7 @@ tests/webtbs/tw9076a.pp svneol=native#text/plain
 tests/webtbs/tw9085.pp svneol=native#text/plain
 tests/webtbs/tw9085.pp svneol=native#text/plain
 tests/webtbs/tw9098.pp svneol=native#text/plain
 tests/webtbs/tw9098.pp svneol=native#text/plain
 tests/webtbs/tw9107.pp svneol=native#text/plain
 tests/webtbs/tw9107.pp svneol=native#text/plain
+tests/webtbs/tw9128.pp svneol=native#text/plain
 tests/webtbs/ub1873.pp svneol=native#text/plain
 tests/webtbs/ub1873.pp svneol=native#text/plain
 tests/webtbs/ub1883.pp svneol=native#text/plain
 tests/webtbs/ub1883.pp svneol=native#text/plain
 tests/webtbs/uw0555.pp svneol=native#text/plain
 tests/webtbs/uw0555.pp svneol=native#text/plain

+ 49 - 0
tests/webtbs/tw9128.pp

@@ -0,0 +1,49 @@
+program BUGGY;
+
+{$MODE delphi}
+
+type
+  TImageFormat = (ifIndex8, ifA8R8G8B8);
+
+  TImageData = packed record
+    Width: Integer;
+    Height: Integer;
+    Format: TImageFormat;
+    Size: Integer;
+    Bits: Pointer;
+    Palette: Pointer;
+  end;
+
+  TDynArray = array of TImageData;
+
+procedure ModImage(var Img: TImageData);
+begin
+  Img.Width := 128;
+  Img.Height := 128;
+end;
+
+procedure ArrayStuff(const Arr: TDynArray);
+var
+  I: Integer;
+begin
+  for I := 0 to High(Arr) do
+    ModImage(Arr[I]);
+end;
+
+var
+  MyArr: TDynArray;
+begin
+  SetLength(MyArr, 5);
+  ArrayStuff(MyArr);
+end.
+
+{
+  bug-interror.pas(30,5) Fatal: Internal error 200106041
+  bug-interror.pas(30,5) Fatal: Compilation aborted
+  
+  Error is caused by const parameter in procedure ArrayStuff(const Arr: TDynArray);
+  Doesn't occur when array is var parameter.
+  Only crashed in $MODE DELPHI.
+  Delphi lets you change elements of array even though
+  array is passed as const parameter.
+}