فهرست منبع

+ test added; thought it was fixed already :)

git-svn-id: trunk@107 -
florian 20 سال پیش
والد
کامیت
2652c764f1
2فایلهای تغییر یافته به همراه34 افزوده شده و 0 حذف شده
  1. 1 0
      .gitattributes
  2. 33 0
      tests/webtbs/tw4010.pp

+ 1 - 0
.gitattributes

@@ -6119,6 +6119,7 @@ tests/webtbs/tw3971.pp svneol=native#text/plain
 tests/webtbs/tw3973.pp svneol=native#text/plain
 tests/webtbs/tw3977.pp svneol=native#text/plain
 tests/webtbs/tw3977.txt svneol=native#text/plain
+tests/webtbs/tw4010.pp svneol=native#text/plain
 tests/webtbs/ub1873.pp svneol=native#text/plain
 tests/webtbs/ub1883.pp svneol=native#text/plain
 tests/webtbs/uw0555.pp svneol=native#text/plain

+ 33 - 0
tests/webtbs/tw4010.pp

@@ -0,0 +1,33 @@
+{ Source provided for Free Pascal Bug Report 4010 }
+{ Submitted by "Adrian" on  2005-05-23 }
+{ e-mail: [email protected] }
+
+{ $mode objfpc}
+program Bug;
+
+type
+  TDynamicByteArray = array of byte;
+  
+function MaxByte(const ar: array of byte): Integer;
+var
+  i: Integer;
+begin
+  Result:= Low(Byte);
+  for i:= Low(ar) to High(ar) do
+    if ar[i] > Result then Result:= ar[i];
+end;
+
+function GenByteArray(const aStr: string): TDynamicByteArray;
+begin
+	SetLength(result, Length(aStr));
+	if Length(aStr) > 0 then
+		Move(aStr[1], result[0], Length(aStr));
+end;
+
+var
+  ar1: TDynamicByteArray;
+begin
+  ar1:= GenByteArray('foo');
+  MaxByte(ar1);
+  MaxByte(GenByteArray('foo')); // compiler stops here
+end.