Hello folks,
perhaps somebody can help me with a strange error which occurs when using Strings under FreeBSD. (It does not occur on DJGPP, EMX, or Linux.)
The error is triggered by the program
Program Crash;
Type WrkString = String ( 80 );
Var S: WrkString;
begin S:= 'A'; if S = 'A' then writeln ( 'Hurra!' ); end.
It compiles fine, the assembly code looks nice, but it gets a signal "iot" (whatever that means) when running. The error happens in the RTS function _p_string() (see rts/rts-string.c):
/* First arg is always a string or char */ if (argument_mask & P_STR_FIRST_IS_CHAR) { c1 = va_arg (p, char); s1 = &c1; len1 = 1; } else { /* It's a string */ s1 = va_arg (p, char *); len1 = va_arg (p, int); /* <------ SIGIOT */ }
When examining the variables with gdb, everything looks nice, too. *p == 'A', etc.
A similar error happens when running the following variant:
Program Crash;
uses CPtr;
Var C: Char value 'A'; P: CharPtr;
begin P:= @C; if P^ = 'A' then writeln ( 'Hurra!' ); end.
It is essential that the type "CharPtr = ^Char" is exported by a Unit, not declared in the program.
First, we get a warning about assignment of incompatible pointers for "P:= @C" which is, of course, nonsense, but I can explain it with the mechanism of forward references in pointer declarations.
Again, the assembler code looks fine, but when running the program, I get a signal. :(
And again, the error does not occur with DJGPP, EMX, or Linux - only with FreeBSD.
DOES ANYBODY HAVE AN IDEA?
Yours,
Peter
e-mail: peter.gerwinski@uni-essen.de home address: D"usseldorfer Str. 35, 45145 Essen, Germany WWW: http://agnes.dida.physik.uni-essen.de/~peter/