pardo@OPUS.CS.WASHINGTON.EDU (Divid Kezzel) (07/19/89)
/* * GCC: version 1.34 * MACHINE: Sequent i386 * CONFIG FILES: As set up by `config.gcc' * SYMPTOM: `cc1' gets fatal signal 11 (SIGSEGV) when compiling the * following program. * REPEAT-BY: gcc -g -Wall -v -c file.c * NOTES: Has inline i386 `asm' functions. Started dumping core when * the `LOCK' and `UNLOCK' functions were added. * * RUNTIME: gcc -g -Wall -v -c tmp.c gcc version 1.34 /uns/usr/local/lib/gcc-cpp -v -undef -D__GNUC__ -Dunix -Di386 -Dsequent -D__unix__ -D__i386__ -D__sequent__ -Wall tmp.c /tmp/cc024582.cpp GNU CPP version 1.34 /uns/usr/local/lib/gcc-cc1 /tmp/cc024582.cpp -quiet -dumpbase tmp.c -g -Wall -version -o /tmp/cc024582.s GNU C version 1.34 (80386, BSD syntax) compiled by GNU C version 1.34. gcc: Program cc1 got fatal signal 11. * * Furthur information upon request. */ # 1 "buf.c" # 1 "/uns/usr/local/lib/gcc-include/assert.h" void __eprintf (); # 21 "buf.c" # 1 "/usr/include/stdio.h" extern struct _iobuf { int _cnt; char *_ptr; char *_base; int _bufsiz; short _flag; char _file; } _iob[20 ]; struct _iobuf *fopen(); struct _iobuf *fdopen(); struct _iobuf *freopen(); long ftell(); char *gets(); char *fgets(); char *sprintf(); # 22 "buf.c" # 1 "/u1/pardo/june/resch/trace/pardo/include/types.h" typedef void *VOIDP; typedef void const * VOIDCP; typedef enum {NO=0, YES} bool; typedef enum { LESS = -1, EQUAL = 0, GREATER = 1 } trinary; typedef unsigned int u_int; # 1 "/u1/pardo/june/resch/trace/pardo/include/types.vax.h" typedef signed char int8; typedef short int12; typedef short int16; typedef int int24; typedef int int32; typedef unsigned char u_int8; typedef unsigned short u_int12; typedef unsigned short u_int16; typedef unsigned int u_int24; typedef unsigned int u_int32; # 134 "/u1/pardo/june/resch/trace/pardo/include/types.h" # 25 "buf.c" # 1 "parallel.h" # 28 "buf.c" # 1 "lock.h" # 30 "lock.h" typedef char BUF_lock_t; static inline void LOCK (BUF_lock_t *laddr) { BUF_lock_t old; old = (1) ; do { asm ("xchgb %0,%1" : "=r" (old), "=m" (*laddr) : "0" (old), "1" (*laddr) ); } while (old != (0) ); } static inline void UNLOCK (BUF_lock_t *laddr) { *laddr = (0) ; } # 69 "lock.h" # 29 "buf.c" # 1 "buf.h" # 1 "buf.i386.h" typedef u_int16 BUF_process_id_t; typedef void * BUF_data_t; # 101 "buf.i386.h" # 115 "buf.i386.h" # 124 "buf.i386.h" # 30 "buf.h" typedef struct BUF_buf_t { struct BUF_buf_t *next; bool pid_done; union { BUF_data_t *last; u_int size; } u; BUF_process_id_t pid; BUF_data_t data[1]; } BUF_buf_t; typedef struct BUF_ppbd_t { BUF_buf_t *base; BUF_data_t *curr; BUF_data_t *last; } BUF_ppbd_t; typedef struct BUF_buf_list_t { BUF_buf_t *tail; BUF_lock_t lock; } BUF_buf_list_t; # 30 "buf.c" extern void *malloc (unsigned nelt); extern void free (void *ptr); extern void abort(void); extern void fprintf (struct _iobuf *fp, char const *format, ...); typedef struct buf_config_t { u_int hash_length; bool malloc_more; bool free_excess; u_int howmany; u_int retries; u_int writers; u_int32 buf_size; } buf_config_t; buf_config_t BUF_config; typedef enum acct_name_t { ACCT_ZERO, FIND_FREE_BUFFER, GC, HTBL_STORE_BUF, HTBL_GET_BUF, ACCT_N } acct_name_t; typedef struct acct_t { u_int count; BUF_lock_t lock; } acct_t; acct_t BUF_acct[ACCT_N]; void BUF_acct_init () { acct_name_t i; for (i=ACCT_ZERO; i<ACCT_N; ++i) { UNLOCK (&BUF_acct[i].lock); BUF_acct[i].count = 0; } } BUF_buf_list_t BUF_fullbufs; BUF_buf_list_t BUF_fullhead; BUF_buf_list_t BUF_freelist; u_int BUF_free_length; BUF_buf_list_t *BUF_hashtbl; u_int BUF_htbl_size; BUF_buf_t * BUF_filled_next () { if (BUF_config.writers > 1) { LOCK (&BUF_fullhead.lock); } return (BUF_fullhead.tail); } bool BUF_htbl_init (size) u_int size; { ((size > 0) ? 0 : (__eprintf ("Failed assertion " "size > 0" " at line %d of `" "buf.c" "'.\n", 233), abort ()) ) ; BUF_hashtbl = (BUF_buf_list_t *) malloc (size * sizeof(BUF_buf_list_t*)); if (!BUF_hashtbl) return (NO); do { BUF_htbl_size = (size); } while(0 ) ; do { --size; UNLOCK (&BUF_hashtbl[size].lock); BUF_hashtbl[size].tail = 0 ; } while (size > 0); return (YES); } void BUF_htbl_store_buf (buf) BUF_buf_t *buf; { u_int where; do { ; } while(0 ) ; where = ((buf->pid) % BUF_htbl_size) ; ((where < (BUF_htbl_size) ) ? 0 : (__eprintf ("Failed assertion " "where < BUF_HTBL_SIZE" " at line %d of `" "buf.c" "'.\n", 258), abort ()) ) ; LOCK (&BUF_hashtbl[where].lock); buf->next = BUF_hashtbl[where].tail; BUF_hashtbl[where].tail = buf; UNLOCK (&BUF_hashtbl[where].lock); } BUF_buf_t * BUF_htbl_get_buf (pid) BUF_process_id_t pid; { BUF_buf_t *buf, **trail; u_int where; do { ; } while(0 ) ; where = ((pid) % BUF_htbl_size) ; ((where < (BUF_htbl_size) ) ? 0 : (__eprintf ("Failed assertion " "where < BUF_HTBL_SIZE" " at line %d of `" "buf.c" "'.\n", 286), abort ()) ) ; LOCK (&BUF_hashtbl[where].lock); for ((trail=&BUF_hashtbl[where].tail), (buf=BUF_hashtbl[where].tail); buf && buf->pid != pid; trail = &buf->next, buf = buf->next) { ; } if (buf) *trail = buf->next; UNLOCK (&BUF_hashtbl[where].lock); do { if (buf) buf->next = 0 ; } while(0 ) ; return (buf); }