Dear Pascalers
The following code core dumps during the set 'in' operation:
------ cut ---------- program setbug(input,output);
CONST FirstChar = ['+','-','0'..'9']; #ifdef FIX GoodChar = ['+','-','0'..'9','.','e','E']; #else GoodChar = FirstChar+['.','e','E']; #endif
VAR ch:CHAR; in_set:BOOLEAN;
BEGIN ch:='0'; writeln('Here we go:'); in_set:= ch IN GoodChar; writeln('in_set is ', in_set); END. ------ cut ----------
ida % gpc -g -o tt tt.p ida % ./tt Here we go: Segmentation fault (core dumped) ida % gdb /usr/local/egcs-1.1b-obj/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.57/gpc1 core [ ... ] Core was generated by `./tt'. Program terminated with signal 11, Segmentation fault. #0 0x80491f5 in rindex () (gdb) backtrace #0 0x80491f5 in rindex () #1 0x4000a1f8 in ?? () #2 0x8049348 in ftell () (gdb)
Note I can fix it by using the alternate code:
ida % gpc -DFIX -g -o tt tt.p ida % ./tt Here we go: in_set is True ida %
Compiler details: ida % gpc -v Reading specs from /usr/local/egcs-1.1b-obj/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.57/specs gpc version 19980830, based on egcs-2.91.57 19980901 (egcs-1.1 release)
Any suggestions ? Of course I can always use the workaround.
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
Hi, Ian! Hi, everybody!
Ian Thurlbeck wrote:
The following code core dumps during the set 'in' operation: [...] Any suggestions ? Of course I can always use the workaround.
This example program reproduces a long-known bug in a well-isolated form which enabled me to fix it eventually. (-:
Patch enclosed.
Thanks for tracking it down,
Peter