Stephan Eickschen wrote:
Frank,
Hard to tell without seeing anything of your code.
yes - I know. But since the (final) error occurs in the string.pas which in fact is from the gpc sources (I have built gpc from source) I was wondering, if someone knows what is going on in this routines.
Well, this routine compares strings. As I said, it's not impossible that it contains a bug, but I can't see any in it. :-)
Perhaps the strings passed to it are invalid (dereference of an invalid pointer) or something.
Please, let me know, what infos - and how to gather them - you would need and I will try to get them out of this lousy box...
Optimally, the complete source of the program (if it's large, not posted to the list, but perhaps put on a web site) and instructions how to reproduce the bug.
If that's not possible, you could try to reduce the program to a simple and as short as possible program that still shows the bug. In this process, maybe you will find the cause of the problem in the program, or reduce it to a short case that help us find and fix a bug in GPC, if any.
Hmmm - as far as I see from the code there are no operations using byte arithmetics. The program reads an ASCII and makes _many_ sorting operations on it. I fear that the seg fault results from a memory overflow / too small sized arrays or something like that...
Might be. Oh, thinking of it, a typical mistake is:
var p: ^String;
GetMem (p, Length (foo) + 1); p^ := foo;
This works with BP's "short strings", but not with GPC's (EP schema) strings (use `New (p, Length (foo))' instead). If there are any occurrences of `GetMem' etc. in the program, check them carefully. You might also want to look at the chapter about BP in the GPC manual.
Frank