Re: prior parameter's size depends on `foo'
In message <19990511213235.C1105@esmeralda.gerwinski.de> Peter Gerwinski writes:
You probably stumbled about a bug in GPC.
To help us to fix GPC it would be best if you reduced the problem to a program `david1.pas' which
* is as short as possible,
* reproduces the bug,
* and is intended to writeln 'OK' if no bug occured and something else otherwise.
The problem is at compile-time, attached is a small module which exhibits this behaviour. My system is Red Hat Linux release 5.2 (Apollo) running kernel 2.0.36 on an i586. I've built gcc-2.8.1 and gpc 19990118. gpc -v gives the following output ----------------------------------------------------------------- Reading specs from /usr/lib/gcc-lib/i586-pc-linux-gnu/2.8.1/specs gpc version 19990118, based on gcc-2.8.1 ----------------------------------------------------------------- Compiling the following module with gpc -c dajmod.p gives the output shown below file dajmod.p: ----------------------------------------------------------------- module dajmod1 interface; export dajmod = (str_tail); procedure str_tail(protected source:string;protected i:integer;var dest:string); end. module dajmod1 implementation; uses gpc; var s1,s2:string(255); i:integer; procedure str_tail; var s2:string(255); begin (*str_tail*) if (length(source)=0) or (i<1) or (i>length(source)) then dest:='' else begin moveleft(source[length(source)-i+1], s2[1], i); (*$x+*) setlength(s2,i); (*$x-*) dest:=s2; end; end; (*str_tail*) end. ----------------------------------------------------------------- Output from compiler: dajmod.p: In function `Str_tail': dajmod.p:9: prior parameter's size depends on `Source' ----------------------------------------------------------------- There may well already be a provided routine to do this (return the last i characters of a string), and if there is, I'd be grateful for a pointer to it, but even so I think I'd still like to be able to write similar procedures/functions. -- David James mailto:david@tcs01.demon.co.uk
participants (2)
-
david@tcs01.demon.co.uk -
Peter Gerwinski