From: c$dje@watson.ibm.com (David Edelsohn)
Newsgroups: gnu.gcc.bug
Subject: gcc-2.2.2 fatal signal 11 bug report
Date: 25 Aug 92 16:07:26 GMT
Distribution: gnu
Organization: GNUs Not Usenet


	The appended source code causes gcc-2.2.2 to crash with an internal
compiler error -- fatal signal 11 from cc1.  Gcc configured for both a Risc
System/6000 running AIX 3.1.7 and a Sun Sparcstation running SunOS 3.1.2
demonstrate this bug.  The appended code is a trimmed version, with include
files prepended, appropriate for an RS/6000 but a Sparcstation will produce
the same results with additional warnings.

					David

% gcc -v bad.c
Reading specs from /contrib/lib/gcc-lib/rs6000/2.2/specs
gcc version 2.2
 /contrib/lib/gcc-lib/rs6000/2.2/cpp -lang-c -v -undef -D__GNUC__=2 -D_IBMR2 -D_AIX -D___IBMR2__ -D___AIX__ -D___IBMR2 -D___AIX -D__CHAR_UNSIGNED__ bad.c /tmp/cckcICkR.i
GNU CPP version 2.2
 /contrib/lib/gcc-lib/rs6000/2.2/cc1 /tmp/cckcICkR.i -quiet -dumpbase bad.c -version -o /tmp/cckcICkR.s
GNU C version 2.2.2 compiled by GNU C version 2.2.
gcc: Internal compiler error: program cc1 got fatal signal 11

-----bad.c-----
typedef char *		va_list;
typedef int		ptrdiff_t;
typedef unsigned short	wchar_t;
typedef long		fpos_t;
typedef	long		time_t;
typedef int		clock_t;
typedef	unsigned long	size_t;
typedef	unsigned char	uchar_t;
typedef	unsigned short	ushort_t;
typedef	unsigned int	uint_t;
typedef unsigned long	ulong_t;
typedef	struct { int r[1]; } *	physadr_t;
typedef long		level_t;
typedef	long		daddr_t;	
typedef	char *		caddr_t;	
typedef	ulong_t		ino_t;		
typedef short		cnt_t;
typedef ulong_t		dev_t;		
typedef	long		chan_t;		
typedef	long		off_t;		
typedef	long		paddr_t;
typedef	long		key_t;
typedef long		timer_t;	
typedef	short		nlink_t;
typedef	ulong_t		mode_t;		
typedef ulong_t		uid_t;		
typedef ulong_t		gid_t;		
typedef	void *		mid_t;		
typedef	int		pid_t;		
typedef char		slab_t[12];	
typedef long            mtyp_t;		
typedef struct label_t {		
	struct label_t *prev;		
	ulong_t           iar;		
	ulong_t           stack;		
	ulong_t           toc;		
	ulong_t           cr;
	ulong_t           intpri;		
	ulong_t           reg[19];	
} label_t;

typedef long		vmid_t;		
typedef ulong_t		vmhandle_t;	

typedef struct vmaddr_t {		
	vmhandle_t	srval;		
	caddr_t		offset;		
} vmaddr_t;

typedef struct adspace_t{		
	ulong_t		alloc;		
	vmhandle_t	srval[16];	
} adspace_t;

typedef struct sigset_t	{
	unsigned long losigs;
	unsigned long hisigs;
} sigset_t;

typedef	uchar_t		uchar;
typedef	ushort_t	ushort;
typedef	uint_t		uint;
typedef ulong_t		ulong;

typedef	physadr_t	physadr;


typedef	unsigned char	u_char;
typedef	unsigned short	u_short;
typedef	unsigned int	u_int;
typedef	unsigned long	u_long;

typedef	struct	_quad { long val[2]; } quad;
typedef	long	swblk_t;


struct sigset	{
	unsigned long losigs;
	unsigned long hisigs;
};


struct fsid {
	long	val[2];
};
typedef struct fsid fsid_t;

struct fid {
	uint_t	fid_len;
	char	fid_data[(	32  - sizeof(fsid_t) - sizeof(uint_t)) ];
};
typedef struct fid fid_t;

struct fileid {			
	uint_t	fid_len;
	ino_t	fid_ino;
	uint_t	fid_gen;
	char	fid_x[(	32  - sizeof(fsid_t) - sizeof(uint_t))  - (sizeof(ino_t) + 2) - sizeof(uint_t)];
};


struct fhandle {
	char x[	32 ];		
};
struct filehandle {			
	fsid_t		fh_fsid;		
	struct fileid	fh_fid;			
};
typedef struct fhandle fhandle_t;

struct unique_id {
       unsigned long word1;
       unsigned long word2;
       unsigned long word3;
       unsigned long word4;
};
typedef struct unique_id unique_id_t;

typedef struct  coldesc  {
	short     cd_stroff;
	short	  cd_repoff;
	short     cd_cval;
	short	  cd_cuniq;
} coldesc_t;




typedef struct collation_table {
	short    lc_version;
	short	 lc_length;			
	char     *lc_locale_name;		
	int      len_collate;
	short    *lc_collate;
	int      len_coluniq;
	short    *lc_coluniq;
	int      len_coldesc;
	coldesc_t *lc_coldesc;
	int	 len_strings;			
	wchar_t  *lc_strings;			
	int	 high_cvalue;			
} col_t;







typedef struct char_classification_table {
	short      lc_version; 		
	short	   lc_length;  		
	short      lc_code_type; 	
	short      mb_cur_max;   	
	short      mb_cur_min;   	
	short      lc_dsp_width;
	char       *lc_locale_name; 	
	int        len_caseconv;   	
	wchar_t    *lc_caseconv;   	
	int	   len_ctype;
	unsigned short *lc_ctype;	 	
} ctype_t;





typedef	struct lc_monetary_table {
	short  	lc_version;
	short 	lc_length;		
	char   	*lc_locale_name;	
	char 	*int_curr_symbol;	
	char 	*currency_symbol;	
	char 	*mon_decimal_point;	
	char 	*mon_thousands_sep;	
	char 	*mon_grouping;		
	char 	*positive_sign;		
	char 	*negative_sign;		
	char 	int_frac_digits;	
	char 	frac_digits;		
	char 	p_cs_precedes;		
	char 	p_sep_by_space;		
	char 	n_cs_precedes;		
	char 	n_sep_by_space;		
	char 	p_sign_posn;		
	char 	n_sign_posn;		
} mon_t;





typedef struct numeric_table {
	short	lc_version;
	short	lc_length;		
	char    *lc_locale_name;	
	char 	*decimal_point;
	char 	*thousands_sep;
	char	*grouping;
} num_t;





typedef struct lc_messages_table {
	short	lc_version;
	short	lc_length;		
	char    *lc_locale_name;	
	char 	*messages;		
	char 	*yes_string;		
	char 	*no_string;		
} msg_t;





typedef struct lc_time_table {
	short   lc_version;
	short	lc_length;	
	char    *lc_locale_name;
	char    *t_fmt;
	char    *d_fmt;
	char    *nlldate;
	char    *d_t_fmt;
	char    *abday;
	char    *day;
	char    *abmon;
	char    *mon;




	char    *misc;
	char    *tstrs;
	char    *tunits;



	char	*year;		
	char    *am_pm;
} tim_t;






typedef struct wchar_mapping_table {
	short    lc_version;
	short	 lc_length;			
	char     *lc_identifier;
} map_t;








typedef struct localeinfo_table {
	char     lc_mag0, lc_mag1;
	short    lc_version;
	short    lc_code_type;
	short	 lc_length;		
	col_t    *lc_coltbl;		
	ctype_t  *lc_chrtbl;		
	mon_t    *lc_montbl;		
	num_t    *lc_numtbl;		
	tim_t    *lc_timtbl;		
	msg_t    *lc_msgtbl;		
	map_t    *lc_maptbl;		
} loc_t;

extern loc_t *_locp;



typedef unsigned short NLchar;

extern char
	*NLstrcpy(),
	*NLstrncpy(),
	*NLstrcat(),
	*NLstrncat(),
	*NLstrchr(),
	*NLstrrchr(),
	*NLstrpbrk(),
	*NLstrtok();
extern NLchar
	*NCstrcpy(),
	*NCstrncpy(),
	*NCstrcat(),
	*NCstrncat(),
	*NCstrchr(),
	*NCstrrchr(),
	*NCstrpbrk(),
	*NCstrtok();
extern NLchar *_NCgetbuf();
extern void free(void *ptr);
extern char _NLflattab[];
extern unsigned _NLflattsize;
extern char _NLesctab[][2];
extern unsigned _NLesctsize;
extern unsigned _NLunesctsize;




extern struct NLescdata {
	unsigned char *key;
	NLchar value;
} _NLunesctab[];
extern int isascii(int c);
extern int toascii(int c);
extern int errno;
extern int errno;
extern char *setlocale(int category, const char *locale);
extern struct lconv *localeconv(void);


typedef struct lconv {
   char *decimal_point;		
   char *thousands_sep;		
   char *grouping;		
   char *int_curr_symbol;	
   char *currency_symbol;	
   char *mon_decimal_point;	
   char *mon_thousands_sep;	
   char *mon_grouping;		
   char *positive_sign;		
   char *negative_sign;		
   char int_frac_digits;	
   char frac_digits;		
   char p_cs_precedes;		
   char p_sep_by_space;		
   char n_cs_precedes;		
   char n_sep_by_space;		
   char p_sign_posn;		
   char n_sign_posn;		
} lconv;
extern  unsigned _DBLINF[2];
extern  double acos(double x);
extern  double asin(double x);
extern  double atan(double x);
extern  double atan2(double x,double y);
extern  double ceil(double x);
extern  double cos(double x);
extern  double cosh(double x);
extern  double exp(double x);
extern  double fabs(double x);
extern  double floor(double x);
extern  double fmod(double x, double y);
extern  double frexp(double value, int *exp);
extern  double ldexp(double x, int exp);
extern  double log(double x);
extern  double log10(double x);
extern  double modf(double value, double *iptr);
extern  double pow(double x, double y);
extern  double sin(double x);
extern  double sinh(double x);
extern  double sqrt(double x);
extern  double tan(double x);
extern  double tanh(double x);

extern int signgam;
extern unsigned int SFPMAX;

extern     double   erf(double x);
extern     double   erfc(double x);
extern     int      isnan(double x);
extern     double   hypot(double x,double y);
extern     double   j0(double x);
extern     double   j1(double x);
extern     double   jn(int n, double x);
extern     double   gamma(double x);
extern     double   lgamma(double x);
extern     double   y0(double x);
extern     double   y1(double x);
extern     double   yn(int n, double x);
typedef struct div_t  {			
	int quot;			
	int rem; } div_t;			

typedef struct ldiv_t  {		
	long int quot;			
	long int rem; } ldiv_t;		

extern double 	atof(const char *nptr);
extern int 	atoi(const char *nptr);
extern long int atol(const char *nptr);
extern double 	strtod(const char *nptr, char * *endptr);
extern long int strtol(const char *nptr, char * *endptr, int base);
extern unsigned long int strtoul(const char *nptr, char * *endptr, int base);
extern int 	rand(void);
extern void	srand(unsigned int seed);
extern void 	*calloc(size_t nmemb, size_t size);
extern void	free(void *ptr);
extern void	*malloc(size_t size);
extern void 	*realloc(void *ptr, size_t size);
extern void	abort(void);
extern int	atexit(void (*func)(void));
extern void	exit(int status);
extern char	*getenv(const char *name);
extern int 	system(const char *string);
extern void 	*bsearch(const void *key, const void *base, size_t nmemb,                       size_t size, int(*compar)());
extern void 	qsort(void *base, size_t nmemb, size_t size, int(*compar)());

extern int 	abs(int j);
extern struct div_t	div(int numer, int denom);
extern long int	labs(long int j);
extern struct ldiv_t 	ldiv(long int numer, long int denom);
extern int 	mblen(const char *s, size_t n);
extern int 	mbtowc(wchar_t *pwc, const char *s, size_t n);
extern int 	wctomb(char *s, wchar_t wchar);
extern size_t 	mbstowcs(wchar_t *pwcs, const char *s,size_t n);
extern size_t 	wcstombs(char *s, const wchar_t *pwcs,size_t n);
     float    atoff();
     char     *ecvt();
     char     *fcvt();
     char     *gcvt();
     float    strtof();
     void     imul_dbl();
     void     umul_dbl();

     struct dbl_hypot {
         double x, y;
     };

extern     double   acosh(double x);
extern     double   asinh(double x);
extern     double   atanh(double x);
extern     double   cabs(struct dbl_hypot p_dbl);
extern     double   cbrt(double x);
extern     double   copysign (double x, double y);
extern     double   drem(double x, double y);
extern     double   exp__E(double x, double y);
extern     double   expm1(double x);
extern     double   log1p(double x);
extern     double   log__L(double x);
extern     double   nearest(double x);
extern     double   rint(double x);
extern     double   scalb(double x, int n);
extern     double   trunc(double x);
extern     int      itrunc(double x);
extern     int      unordered(double x, double y);
extern     unsigned  uitrunc(double x);

extern     int      dtoi(double x);

extern     double   logb();
extern     int      ilogb();
extern     double   nextafter();
extern     int      class();
extern     int      finite();

struct exception {
	int type;
	char *name;
	double arg1;
	double arg2;
	double retval;
};
typedef int jmp_buf[64	];

extern void longjmp(jmp_buf env, int val);
extern int setjmp(jmp_buf env);

typedef int sigjmp_buf[64	];

extern int sigsetjmp(sigjmp_buf env, int savemask);
extern void siglongjmp(sigjmp_buf env, int val);

extern void (*signal(int sig, void (*func)(int)))(int);

extern int raise(int sig);

typedef volatile int sig_atomic_t;
struct sigaction {
	void	(*sa_handler)(int);	

	sigset_t sa_mask;		
	int	sa_flags;		
};

extern int kill(pid_t pid, int sig);
extern int sigaction(int sig, struct sigaction *act, struct sigaction *oact);
extern int sigprocmask(int how, sigset_t *set, sigset_t *oset);
extern int sigsuspend(sigset_t *set);


extern int sigemptyset(sigset_t *set);
extern int sigfillset(sigset_t *set);
extern int sigaddset(sigset_t *set, int signo);
extern int sigdelset(sigset_t *set, int signo);
extern int sigismember(sigset_t *set, int signo);
extern int sigpending(sigset_t *set);
struct mstsave	{

	struct mstsave	*prev;		
	label_t		*kjmpbuf;	
	char		*stackfix;	
	char		intpri; 	
	char		backt;		
	char		rsvd[2];	
	pid_t		curid;		

	int		excp_type;	
	ulong_t		iar;		
	ulong_t		msr;		
	ulong_t		cr;		
	ulong_t		lr;		
	ulong_t		ctr;		
	ulong_t		xer;		
	ulong_t		mq;		
	ulong_t		tid;		
	ulong_t		fpscr;		
	char		fpeu;		

	char            pad[3];
	ulong_t         except[5];	
	void		*bus;		

	ulong_t         o_iar;
        ulong_t         o_toc;
	ulong_t         o_arg1;

	ulong_t		excbranch;	



	ulong_t		cachealign[9];	

	adspace_t	as;		
	ulong_t		gpr[32 ];	
	double		fpr[32 ];	
};
struct	jmpbuf	{
	struct	mstsave	jmp_context;
};

extern int sigstack();



struct	sigstack {
	char	*ss_sp;			
	int	ss_onstack;		
};

struct	sigcontext {
	int		sc_onstack;	
	sigset_t	sc_mask;	
	int		u_error;	
	struct	jmpbuf	sc_jmpbuf;	
};

struct	sigvec {





	void    (*sv_handler)(int);	

	int     sv_mask;
	int     sv_flags;
};

void va_end (va_list);		
typedef struct {
	unsigned char	*_ptr;
	int	_cnt;
	unsigned char	*_base;
	unsigned char   *_bufendp;
	short	_flag;
	short	_file;
	int	_unused[3];
} FILE;

extern FILE	_iob[	20 ];

extern size_t 	fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
extern size_t	fwrite(const void *ptr, size_t size, size_t nmemb,FILE *stream);

extern int  	_filbuf(FILE *iop);
extern int	_flsbuf(unsigned char c, FILE *iop);
extern int 	ferror(FILE *stream);
extern int 	feof(FILE *stream);
extern void 	clearerr(FILE * stream);
extern int 	putchar(int c);
extern int 	getchar(void);
extern int 	putc(int c, FILE *stream);
extern int 	getc(FILE *stream);
extern int	remove(const char *filename);
extern int	rename(const char *old, const char *new);
extern FILE 	*tmpfile(void);
extern char 	*tmpnam(char *s);
extern int 	fclose(FILE *stream);
extern int 	fflush(FILE *stream);
extern FILE	*fopen(const char *filename, const char *mode);
extern FILE 	*freopen(const char *filename, const char *mode, FILE *stream);
extern void 	setbuf(FILE *stream, char *buf);
extern int 	setvbuf(FILE *stream, char *buf, int mode, size_t size);
extern int	fprintf(FILE *stream, const char *format, ...);
extern int	fscanf(FILE *stream, const char *format, ...);
extern int	printf(const char *format, ...);
extern int	scanf(const char *format, ...);
extern int	sprintf(char *s, const char *format, ...);
extern int	sscanf(const char *s, const char *format, ...);

extern int	vfprintf(FILE *stream, const char *format, va_list arg);
extern int	vprintf(const char *format, va_list arg);
extern int	vsprintf(char *s, const char *format, va_list arg);

extern int 	fgetc(FILE *stream);
extern char 	*fgets(char *s, int n, FILE *stream);
extern int 	fputc(int c, FILE *stream);
extern int 	fputs(const char *s, FILE *stream);
extern char 	*gets(char *s);
extern int 	puts(const char *s);
extern int	ungetc(int c, FILE *stream);
extern int	fgetpos(FILE *stream, fpos_t *pos);
extern int 	fseek(FILE *stream, long int offset, int whence);
extern int	fsetpos(FILE *stream, const fpos_t *pos);
extern long	ftell(FILE *stream);
extern void	rewind(FILE *stream);
extern void 	perror(const char *s);

extern int 	fileno(FILE *stream);
extern FILE 	*fdopen(int fildes, char *type);

extern int 	getw(FILE *stream);
extern int 	putw(int w, FILE *stream);
extern char 	*tempnam(char*,char*);
extern FILE 	*popen(char *cmd, char *mode);
extern int 	pclose(FILE *ptr);
extern char	*ctermid(char *);
extern char 	*cuserid(char *);
extern void	*memchr(const void *s, int c, size_t n);
extern void	*memcpy(void *s1, const void *s2, size_t n);
extern void	*memset(void *s, int c, size_t n);
extern size_t 	strcspn(const char *s1, const char *s2);
extern size_t	strlen(const char *s);
extern size_t	strspn(const char *s1, const char *s2);

extern void 	*memmove(void *s1, const void *s2, size_t n);
extern char 	*strcpy(char *s1, const char *s2);
extern char 	*strncpy(char *s1, const char *s2, size_t n);
extern char 	*strcat(char *s1, const char *s2);
extern char	*strncat(char *s1, const char *s2, size_t n);
extern int 	memcmp(const void *s1, const void *s2,size_t n);
extern int	strcmp(const char *s1, const char *s2);
extern int	strcoll(const char *s1, const char *s2);
extern int	strncmp(const char *s1,const char *s2,size_t n);
extern size_t 	strxfrm(char *s1, const char *s2, size_t n);
extern int	strncollen(const char *, const int );
extern char	*strchr(const char *s, int c);
extern char	*strpbrk(const char *s1, const char *s2);
extern char	*strrchr(const char *s, int c);
extern char	*strstr(const char *s1, const char *s2);
extern char 	*strtok(char *s1, const char *s2);
extern char 	*strerror(int errnum);

extern void	*memccpy(void *target, const void *source, int c, size_t n);
extern char     *index(const char *s, int c);
extern char     *rindex(const char *s, int c);
struct	tm {	
	int	tm_sec;
	int	tm_min;
	int	tm_hour;
	int	tm_mday;
	int	tm_mon;
	int	tm_year;
	int	tm_wday;
	int	tm_yday;
	int	tm_isdst;
};

extern clock_t 	clock(void);
extern double 	difftime(time_t time1, time_t time0);
extern time_t 	mktime(struct tm *timeptr);
extern time_t 	time(time_t *timer);
extern char 	*asctime(const struct tm *timeptr);
extern char 	*ctime(const time_t *timer);
extern struct tm *gmtime(const time_t *timer);
extern struct tm *localtime(const time_t *timer);
extern size_t 	strftime(char *s, size_t maxsize, const char *format,                           const struct tm *timeptr);

extern char *tzname[];
extern void tzset(void);

extern long timezone;
extern int daylight;
extern unsigned char *NLctime(long *t);
extern unsigned char *NLasctime(struct tm *t);
extern char *NLstrtime(char *s, size_t maxsize, const char *format,                                    const struct tm *timeptr);

typedef unsigned char	UByte;
typedef unsigned short	UShort;
typedef unsigned long	ULong;

  typedef long		 AInt;
  typedef unsigned long	 UAInt;

typedef int		Bool;
typedef UAInt		Hash;
typedef size_t		Length;
typedef ULong		Offset;
typedef ULong		Millisec;

   typedef void		*Pointer;
   typedef const void	*ConstPointer;

typedef char		*String;

typedef char		*IOMode;

typedef float		SFloat;
typedef double		DFloat;
   typedef long double	LongDouble;

typedef double	MostAlignedType;
extern int	osRun		(String);

extern Millisec	osCpuTime       (void);

extern String	osDate          (void);
extern String	osGetenv	(String envar);
extern String	osExtSep;
extern String	osDirSep;
extern String	osPathSep;
extern String   osCurDirName;
extern String   osDefaultExecutePath;
extern String   osDefaultLibraryPath;
extern String   osDefaultIncludePath;

extern String	osExecutePath	(void);
extern String	osLibraryPath	(void);
extern String	osIncludePath	(void);

extern void	osFnameParse    (String* partv, String buffer,
				 String fname, String relativeTo);
extern String   osFnameUnparse  (String dir, String name, String type,
				 String buffer);
extern Length   osFnameLength   (String dir, String name, String type);

extern IOMode	osIoRdMode;
extern IOMode	osIoWrMode;
extern IOMode	osIoApMode;
extern IOMode	osIoRbMode;
extern IOMode	osIoWbMode;
extern IOMode	osIoAbMode;
extern IOMode	osIoRubMode;
extern IOMode	osIoWubMode;
extern IOMode	osIoAubMode;
extern int	osFileRemove   (String fn);
extern Hash     osFileHash     (String fn);
extern Bool	osIsInteractive(FILE *);
	
typedef	void		(*SignalHandler) (int signal);

extern SignalHandler	osSetBreakHandler(SignalHandler);
extern SignalHandler	osSetFaultHandler(SignalHandler);
extern SignalHandler	osSetLimitHandler(SignalHandler);

extern Pointer	osAllocBytes     (unsigned align, unsigned long nbytes);

struct osMemMap {
	int	use;
	Pointer	lo, hi;
};

extern struct osMemMap	*osMemMap(int mask);

enum osCcTag {
    OSCC_START,				
	OSCC_LibPath = OSCC_START,	
	OSCC_Library,			
	OSCC_IncPath,			
	OSCC_Define,			
	OSCC_Undefine,			
	OSCC_Optimize,			
	OSCC_DebugInfo,			
	OSCC_ProfileInfo,		
	OSCC_OutputFile,		
    OSCC_LIMIT
};

struct osCcOption {
	enum osCcTag		tag;
	String			arg;
	struct osCcOption	*next;
};

extern int	osCCompileCommand (String buf, int fnc, String *fnv,
				   struct osCcOption *,
				   String cmd, String xopts);
extern int	osLinkCommand	  (String buf , int fnc, String *fnv,
				   struct osCcOption *,
				   String cmd, String xopts);
 	
struct osObjectRenumber {
	char *	functionName;
	int	oldStart, newStart;
	int	lnoc;
	struct	{int old, new;} *lnov;
};

extern void	osObjectRenumber  (String fname, struct osObjectRenumber *);

extern void	testSelf	(String testName);

    extern Bool dbFlag;

extern int  findent;
extern int  fnewline    (FILE *f);

typedef int (*XPutFun)  (const char *s, int n);

extern  int  xprintf	(XPutFun, const char *fmt, ...);
extern  int  vxprintf	(XPutFun, const char *fmt, va_list argp);

struct fluidCell {
	String		scopeName;	
	int		scopeLevel;	
	Pointer		pglobal,	
			pstack;		
	long		size;		
};

typedef struct {
	int		fluidLevel;
	jmp_buf         buf;
} JmpBuf;

extern struct fluidCell	*fluidStack;

extern int		 fluidLevel,	
			 fluidLimit,	
			 fluidIncrement;

extern int		 scopeLevel;	

extern struct fluidCell	*fluidGrow	(void);
extern void		 fluidUnwind	(int toCell, Bool isLongJmp);

extern MostAlignedType* stoAlloc        (unsigned code, Length size);
extern void             stoFree         (Pointer p);
extern void             stoGc           (void);

extern Length           stoSize         (Pointer p);
extern MostAlignedType* stoResize       (Pointer p, Length size);

extern unsigned         stoCode         (Pointer p);
extern MostAlignedType* stoRecode       (Pointer p, unsigned code);

extern Bool             stoIsPointer    (Pointer p);

extern void             stoAudit        (void);
extern void     	stoShow 	(void);

extern ULong            stoBytesOwn;
extern ULong            stoBytesAlloc;
extern ULong		stoBytesFree;
extern ULong		stoBytesGc;
extern ULong		stoPiecesGc[32 ];

typedef MostAlignedType*	(*StoErrorFun)  (int errnum);
extern  StoErrorFun     	stoSetHandler   (StoErrorFun);
				
extern  StoErrorFun		stoSetFreeAgain	(StoErrorFun);
extern void	exitSuccess	();
extern void	exitFailure	();

typedef void	(*ExitFun)	(int status);
extern ExitFun	exitSetHandler	(ExitFun);	
extern Bool	exitTrap;			

extern void	bug		(String fmt, ...);

extern ULong	_binPrime[];

extern int cielLg (ULong);

typedef struct btree     *BTree;
typedef struct btreePart *BTreePart;

typedef Length           BTreeKey;
typedef Pointer          BTreeElt;

typedef BTreeElt	 (*BTreeEltFun)  (BTreeElt);
typedef BTree   	 (*BTreeAllocFun)(Length nbytes);
typedef void    	 (*BTreeFreeFun) (BTree);

struct btreePart {
	BTree            branch;
	BTreeKey         key;
	BTreeElt         entry;
};

struct btree {
	Bool             isLeaf;
	unsigned short   t;
	unsigned short   nKeys;
	struct btreePart part[		10 ];	
};

extern BTree    btreeNew        (Length t);
extern void     btreeFree       (BTree);
extern void     btreeInsert     (BTree*, BTreeKey, BTreeElt);
extern void     btreeDelete     (BTree*, BTreeKey, BTreeElt *);

extern BTree    btreeNewX       (Length t, BTreeAllocFun);
extern void     btreeFreeX      (BTree,    BTreeFreeFun);
extern void     btreeInsertX    (BTree*, BTreeKey, BTreeElt,  BTreeAllocFun);
extern void     btreeDeleteX    (BTree*, BTreeKey, BTreeElt *,BTreeFreeFun);

extern BTree    btreeNMap       (BTreeEltFun, BTree);
extern BTree    btreeSearchEQ   (BTree, BTreeKey, int *pIx);
extern BTree    btreeSearchGE   (BTree, BTreeKey, int *pIx);
extern BTree    btreeSearchMin  (BTree, int *pIx);
extern BTree    btreeSearchMax  (BTree, int *pIx);

extern int      btreeCheck      (BTree);
extern int     	btreePrint      (FILE *, BTree);
static Length fixedSize[] = {
	4, 8, 16, 24, 32, 40, 48, 64, 80, 96,     128
};

static UByte  fixedSizeFor     [    128    +1];
				
static UByte  fixedSizeIndexFor[    128    +1];
enum PgKind {
		PgFree,
		PgBusyFirst,
		PgBusyFollow,
		PgPgMap,
		PgBTree,
		PgDLL,
		PgForeign
};

typedef char		Page[(1L<<         12    )   ];
typedef UByte		PgInfo;
typedef UByte		QmInfo;

typedef enum   PgKind	PgKind;		
typedef struct PgMem 	PgMem;		

typedef struct Section	Section; 	
typedef struct FxMem	FxMem;	 	
typedef struct MxMem    MxMem;	 	

static   MostAlignedType *stoDefaultError  (int errnum);
static StoErrorFun 	stoError   	 = stoDefaultError;
static StoErrorFun 	stoFreeAgain   	 = stoDefaultError;

static int      stoIsInit  = 0;

static char     *heapStart,
		*heapEnd;

static PgInfo   *pgMap;
static Length   pgMapSize;
static Length	pgMapUses;

static PgMem    *freePages;

static FxMem    *fixedPieces[ (sizeof(fixedSize)/sizeof(fixedSize[0])) ];
static BTree    mixedPieces;
static MxMem    *mixedFrontier;

ULong          stoBytesOwn;	
ULong          stoBytesAlloc;	
ULong          stoBytesFree;	
ULong          stoBytesGc;	
ULong	       stoPiecesGc[32 ];	
struct Section {
	short           pgCount;

	short           qmSize;
	UByte           qmSizeIndex;
	 UByte       isFixed;

	Length          qmCount;
	Pointer         data;
	QmInfo          info[		10 ];
};

static  Length
sectQmCount(Length pageCount, Length qmSize)
{
	return (pageCount * (1L<<         12    )    - (sizeof(Section) +  0 * sizeof( QmInfo) - 		10  * sizeof( QmInfo))  )/(qmSize + sizeof(QmInfo));
}




static  Section *
sectPrepare(Page *p, Length npages, Length sz, int isFixed)
{
	Section *x     = (Section *) p;
	Length  i, nq;

	x->pgCount     = npages;
	x->qmSize      = sz;
	x->qmSizeIndex = fixedSizeIndexFor[sz <=     128     ? sz : 0];
	x->isFixed     = isFixed;
	x->qmCount     = nq = sectQmCount(npages, sz);
	x->data        = (Pointer)((char *) p + npages * (1L<<         12    )    -nq * sz);
	



		x->info[0] =       (  0x40 ) 	;
	if (isFixed)
		for (i = 1; i < nq; i++)
				x->info[i] =       (  0x40 ) 	;
	else
		for (i = 1; i < nq; i++)
				x->info[i] =       (     0x00 ) 	;

	return x;
}

static  Section *
_sectFor(Pointer p)
{
	Length  pi;

	if (!isInHeap(p)) goto error;
	pi = pgNo(p);
	if (pgMap[pi] == PgBusyFirst)
		return (Section *)((Page *) heapStart + pi);
	if (pgMap[pi] != PgBusyFollow)
		goto error;
	while (pgMap[pi] == PgBusyFollow)
		pi--;
	if (pgMap[pi] == PgBusyFirst)
		return (Section *)((Page *) heapStart + pi);
error:  (*stoError)(2  );
	{printf("Not supposed to reach line %d in file: %s\n",359, "store.c"); return 0;} ;
}

===============================================================================
David Edelsohn                                      T.J. Watson Research Center
c$dje@watson.ibm.com                                P.O. Box 218
+1 914 945 3011 (Tieline 862)                       Yorktown Heights, NY 10598
"If G-D had wanted us to vote, he would have given us candidates" -- Jay Leno
Newsgroups: gnu.gcc.bug