Dear Pascalers
I'm having difficulty characterising a bug in the gpc-19990813 release with egcs-1.1.2. Note that the program runs fine under gpc-19990118.
I have ~300 lines of legacy code which basically reads double values from a file (using fopen(), fread(), I might add), converts them to strings using a complicated set of routines to format the strings, etc and writes them to another file (actually I've taken the writes out now).
On files with more than about 72000 double values my program crashes:
... 72085 72086 72087 72088
Program received signal SIGSEGV, Segmentation fault. Integertostring (I=131083, S=@0xbf800210) at mxtx.p:103 103 VAR Cs:STRING; Negative:BOOLEAN; Fig:INTEGER; (gdb) where #0 Integertostring (I=131083, S=@0xbf800210) at mxtx.p:103 #1 0x804a647 in Makefigstring (R=1310825.1112762, Sf=6, Expval=6, S=@0xbf8007a8) at mxtx.p:158 #2 0x804b070 in Realtostring (R=1310825.1112762, Sf=6, S=@0xbffffbd4) at mxtx.p:194 #3 0x804c2ac in Convert (Fid=@0x8065080, Rowsinfile=13693, Colsinfile=6, Sigfig=6) at mxtx.p:248 #4 0x804c532 in program_Mxtx () at mxtx.p:262 #5 0x804c598 in main (argc=1, argv=0xbffffd10, envp=0xbffffd18) at mxtx.p:264
STRING is typed as string(250); and the program does *lots* of string manipulation, maybe this is bad?
Trapping the conversion that causes the problem gives this trace:
(gdb) 158 IntegerToString(MantVal1,MS1); (gdb) s Integertostring (I=470428, S=@0xbf800228) at mxtx.p:103 103 VAR Cs:STRING; Negative:BOOLEAN; Fig:INTEGER; (gdb) n
Program received signal SIGSEGV, Segmentation fault. Integertostring (I=470428, S=@0xbf800228) at mxtx.p:103
This seems to be in the initialisation of the local variables. Is this right ? Any ideas for further progression ?
Many thanks
Ian -- Ian Thurlbeck http://www.stams.strath.ac.uk/ Statistics and Modelling Science, University of Strathclyde Livingstone Tower, 26 Richmond Street, Glasgow, UK, G1 1XH Tel: +44 (0)141 548 3667 Fax: +44 (0)141 552 2079