Dear all,
is the following a bug or might I have made a mistake in building gpc 20060325?
program strof; begin writeln(StringOf('')); end.
compiles but execution terminates with
invalid subrange size (error #301 at 1992b) Trace/BPT trap
Best regards, Peter
On Mon, 17 Apr 2006, Peter Schorn wrote:
Dear all,
is the following a bug or might I have made a mistake in building gpc 20060325?
program strof; begin writeln(StringOf('')); end.
compiles but execution terminates with
invalid subrange size (error #301 at 1992b) Trace/BPT trap
I cannot find a "StringOf" in the gpc docs. Perhaps you meant "StringOfChar" ?
Russ
Peter Schorn wrote:
Dear all,
is the following a bug or might I have made a mistake in building gpc 20060325?
program strof; begin writeln(StringOf('')); end.
compiles but execution terminates with
invalid subrange size (error #301 at 1992b) Trace/BPT trap
A bug. The following should fix it:
--- gpc/p/rts/string2.pas~ 2006-01-29 03:59:07.000000000 +0100 +++ gpc/p/rts/string2.pas 2006-04-19 00:01:51.801085952 +0200 @@ -436,7 +436,8 @@ for n := 1 to Count do begin k := Lengths^[n - 1]; - Res^[Size + 1 .. Size + k] := Strings^[n - 1]^[0 .. k - 1]; + if k > 0 then + Res^[Size + 1 .. Size + k] := Strings^[n - 1]^[0 .. k - 1]; Inc (Size, k) end; { Clean up and return result }