19991023 segfault compiling XFree86

Alan Modra alan@SPRI.Levels.UniSA.Edu.Au
Tue Oct 26 16:11:00 GMT 1999


The following is preprocessed and distilled from
XFree86-335/programs/rstart/server.c

Reading symbols from /usr/lib/gcc-lib/i586-linux/2.96/cc1...done.
(gdb) info stack
#0  make_edge (edge_cache=0x0, src=0x826b868, dst=0x0, flags=0)
at /usr/src/egcs/gcc/flow.c:1110
#1  0x81043aa in make_label_edge (edge_cache=0x0, src=0x826b868, 
label=0x401131a0, flags=0) at /usr/src/egcs/gcc/flow.c:1142
#2  0x8104034 in make_edges (label_value_list=0x0)
at /usr/src/egcs/gcc/flow.c:996
#3  0x81036ea in find_basic_blocks (f=0x401104a0, nregs=31, file=0x0, 
do_cleanup=1) at /usr/src/egcs/gcc/flow.c:435
#4  0x80db17c in delete_null_pointer_checks (f=0x401104a0)
at /usr/src/egcs/gcc/gcse.c:4961
#5  0x804c387 in rest_of_compilation (decl=0x40111180)
at /usr/src/egcs/gcc/toplev.c:3804
#6  0x81ed59d in finish_function (nested=0) at /usr/src/egcs/gcc/c-decl.c:6715
#7  0x81de521 in yyparse () at c-parse.y:350
#8  0x804b411 in compile_file (name=0xbffff993 "/usr/tmp/ccuDsF3B.i")
at /usr/src/egcs/gcc/toplev.c:3200
#9  0x804ecac in main (argc=8, argv=0xbffff814)
at /usr/src/egcs/gcc/toplev.c:5555

**********************
typedef int __pid_t;			 
extern __pid_t fork  (void)    ;
extern int printf  (__const char *__restrict __format, ...)    ;
extern char *strerror  (int __errnum)    ;
extern int errno;
extern int *__errno_location  (void)     __attribute__ ((__const__));
extern void _exit  (int __status)   __attribute__ ((__noreturn__));
extern void exit  (int __status)     __attribute__ ((__noreturn__));
extern int close  (int __fd)    ;
extern int dup  (int __fd)    ;
extern int open  (__const char *__file, int __oflag, ...)    ;


char	myname[]="foo";

detach()
{
	switch(fork()) {
	    case -1:
		printf("%s: Error: fork - %s\n",myname, strerror((*__errno_location ()) ));
		exit(255);
	    case 0:
		 
		close(0);
		close(1);
		close(2);
		dup(dup(open("/dev/null", 02 )));
		return;
	    default:
		 
		_exit(0);
	}
}



More information about the Gcc-bugs mailing list