% uname -a
Linux porsche 2.2.14-6.1.1smp #1 SMP Thu Apr 13 19:55:55 EDT 2000 i686 unknown
% ls -l tsort.c
-r--r--r--    1 bww      users        9921 Sep 13  1999 tsort.c
% sum tsort.c 
01550    10
% rm tsort
% make tsort
gcc  -g -O2   -o tsort  tsort.o ../lib/libtu.a 
% ./tsort --version 
tsort (GNU textutils) 2.0a
Written by Mark Kettenis.

Copyright (C) 1999 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
% cat TSORT-FAULT 
a b
b a
b c
% ./tsort < TSORT-FAULT
./tsort: -: input contains a loop:
./tsort: a
./tsort: b
./tsort: c
Segmentation fault (core dumped)
% gdb tsort core 
GNU gdb 5.0
Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
Core was generated by `./tsort'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
#0  0x8048f28 in detect_loop (k=0x804ce28) at tsort.c:322
322               k = k->top->suc;
(gdb) list
317         {
318           while (k && k->count > 0)
319             {
320               k->count = 0;
321               fprintf (stderr, "%s: %s\n", program_name, k->str);
322               k = k->top->suc;
323             }
324
325           exit (EXIT_FAILURE);
326         }
(gdb) print k->top
$1 = (struct successor *) 0x0
(gdb) quit

Reply via email to