blob: 5af8ae42e32431e93a538d75ad374e085b84189a (
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
32
33
|
{ Source provided for Free Pascal Bug Report 4010 }
{ Submitted by "Adrian" on 2005-05-23 }
{ e-mail: adrian@veith-system.de }
{$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.
|