🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #1324

Internal compiler error for gcc-2.3.1 on romp-ibm-aos.

#1324
From: Tim Theisen
Date: Mon, 09 Nov 1992 04:22
492 lines
18845 bytes
The following input causes an internal compiler error when compiled at
optimization level 2 or 3 with gcc-2.3.1 on an IBM RT running BSD 4.3.
Reducing to optimization level 1 allows it to be compiled.

Here is the invocation:

$ gcc -v -O2 -c zht.c
Reading specs from /usr/gnu/lib/gcc-lib/romp-ibm-aos/2.3.1/specs
gcc version 2.3.1
 /usr/gnu/lib/gcc-lib/romp-ibm-aos/2.3.1/cpp -lang-c -v -undef -D__GNUC__=2 -Dibm032 -Dunix -D__ibm032__ -D__unix__ -D__ibm032 -D__unix -D__CHAR_UNSIGNED__ -D__OPTIMIZE__ zht.c /usr/tmp/cc009938.i
GNU CPP version 2.3.1
 /usr/gnu/lib/gcc-lib/romp-ibm-aos/2.3.1/cc1 /usr/tmp/cc009938.i -quiet -dumpbase zht.c -O2 -version -o /usr/tmp/cc009938.s
GNU C version 2.3.1 compiled by GNU C version 2.3.1.
zht.c: In function `screen_sample':
zht.c:441: internal error--unrecognizable insn:
(insn 238 74 59 (reg:SI 6 r6) -1 (nil)
   (nil))
gcc: Internal compiler error: program cc1 got fatal signal 5

Here is the input:
------------------8<----------------zht.c----------------------------
extern	struct	_iobuf {
	int	_cnt;
	char	*_ptr;		 
	char	*_base;		 
	int	_bufsiz;
	short	_flag;
	char	_file;		 
} _iob[];
typedef unsigned long size_t;
typedef char *va_list;
struct _iobuf 	*fopen(const char *filename, const char *type);
struct _iobuf 	*freopen(const char *filename, const char *type, struct _iobuf  *stream);
struct _iobuf 	*fdopen(int fildes, const char *type);
struct _iobuf 	*popen(const char *command, const char *type);
int	pclose(struct _iobuf  *stream);
int	fflush(struct _iobuf  *stream);
int	fclose(struct _iobuf  *stream);
int	remove(const char *path);
int	rename(const char *from, const char *to);
struct _iobuf 	*tmpfile(void);
char	*tmpnam(char *s);
int	setvbuf(struct _iobuf  *iop, char *buf, int type, size_t size);
int	setbuf(struct _iobuf  *stream, char *buf);
int	setbuffer(struct _iobuf  *stream, char *buf, size_t size);
int	setlinebuf(struct _iobuf  *stream);
int	fprintf(struct _iobuf  *stream, const char *format, ...);
int	printf(const char *format, ...);
char	*sprintf(char *s, const char *format, ...);
int	vfprintf(struct _iobuf  *stream, const char *format, va_list arg);
int	vprintf(const char *format, va_list arg);
int	vsprintf(char *s, const char *format, va_list arg);
int	fscanf(struct _iobuf  *stream, const char *format, ...);
int	scanf(const char *format, ...);
int	sscanf(const char *s, const char *format, ...);
int	fgetc(struct _iobuf  *stream);
int	getw(struct _iobuf  *stream);
char	*fgets(char *s, int n, struct _iobuf  *stream);
char	*gets(char *s);
int	fputc(int c, struct _iobuf  *stream);
int	putw(int w, struct _iobuf  *stream);
int	fputs(const char *s, struct _iobuf  *stream);
int	puts(const char *s);
int	ungetc(int c, struct _iobuf  *stream);
int	fread(void *ptr, size_t size, size_t count, struct _iobuf  *iop);
int	fwrite(const void *ptr, size_t size, size_t count, struct _iobuf  *iop);
int	fseek(struct _iobuf  *stream, long offset, int ptrname);
long	ftell(struct _iobuf  *stream);
void rewind(struct _iobuf  *stream);
int	fgetpos(struct _iobuf  *stream, long *pos);
int	fsetpos(struct _iobuf  *stream, const long *pos);
void perror(const char *s);
typedef unsigned char byte;
typedef unsigned char uchar;
typedef unsigned short ushort;
typedef unsigned int uint;
typedef unsigned long ulong;
typedef	unsigned char	u_char;
typedef	unsigned short	u_short;
typedef	unsigned int	u_int;
typedef	unsigned long	u_long;
typedef	unsigned short	ushort_ ;		 
typedef	struct	_physadr { int r[1]; } *physadr;
typedef	struct	label_t	{
	int	val[11];
} label_t;
typedef	struct	_quad { long val[2]; } quad;
typedef	long	daddr_t;
typedef	char *	caddr_t;
typedef	u_long	ino_t;
typedef	long	swblk_t;
typedef	long	time_t;
typedef	short	dev_t;
typedef	long	off_t;
typedef	u_short	uid_t;
typedef	u_short	gid_t;
typedef signed char prio_t;	 
typedef long	fd_mask;
typedef	struct fd_set {
	fd_mask	fds_bits[(((256 )+(( (sizeof(fd_mask) * 8		)	)-1))/( (sizeof(fd_mask) * 8		)	)) ];
} fd_set;
typedef struct qhdr {
	struct qhdr *link, *rlink;
} *queue_t;
typedef char *ptr_ord_t;
typedef double floatp;
typedef char *(*proc_alloc_t)(unsigned num_elements, unsigned element_size, const char *client_name );
typedef void (*proc_free_t)(char *data, unsigned num_elements, unsigned element_size, const char *client_name );
extern struct _iobuf  *gs_out;
typedef struct gs_point_s {
	double x, y;
} gs_point;
typedef struct gs_int_point_s {
	int x, y;
} gs_int_point;
typedef struct gs_rect_s {
	gs_point p, q;			 
} gs_rect;
typedef struct gs_int_rect_s {
	gs_int_point p, q;
} gs_int_rect;
typedef struct gs_state_s gs_state;
typedef struct {
	proc_alloc_t alloc;
	proc_free_t free;
} gs_memory_procs;
char *gs_malloc(uint, uint, const char * );
void gs_free(char *, uint, uint, const char * );
extern char gs_debug[128];
extern int gs_log_error(int, const char   *, int );
typedef struct ref_s ref;
typedef enum {
	t_array,			 
	t_boolean,			 
	t_condition,			 
	t_dictionary,			 
	t_file,				 
	t_fontID,			 
	t_gstate,			 
	t_integer,			 
	t_lock,				 
	t_mark,				 
	t_name,				 
	t_null,				 
	t_operator,			 
	t_real,				 
	t_save,				 
	t_string,			 
	t_mixedarray,			 
	t_shortarray,			 
	t_color,			 
	t_device,			 
	t_oparray,			 
	t_next_index		 
} ref_type;
					 
					 
typedef struct dict_s dict;
typedef struct name_s name;
typedef int (*dummy_op_proc_p)();
struct stream_s;
struct gs_font_s;
struct gs_color_s;
struct gs_condition_s;
struct gs_lock_s;
struct gx_device_s;
struct gstate_obj_s;
struct vm_save_s;
struct tas_s {
	ushort type_attrs;
	ushort rsize;
};
struct ref_s {
	struct tas_s tas;
	union v {			 
		long intval;
		ushort index;		 
		float realval;
		byte *bytes;
		struct ref_s *refs;
		name *pname;
		dict *pdict;
		ushort *packed;
		dummy_op_proc_p opproc;
		struct stream_s *pfile;
		struct gs_font_s *pfont;
		struct gs_color_s *pcolor;
		struct gs_condition_s *pcond;
		struct gs_lock_s *plock;
		struct gx_device_s *pdevice;
		struct gstate_obj_s *pgstate;
		struct vm_save_s *psave;
	} value;
};
void *memccpy(void *t, const void *f, int c, size_t n);
void *memchr(const void *s, int c, size_t n);
int memcmp(const void *s1, const void *s2, size_t n);
void *memcpy(void *t, const void *f, size_t n);
void *memset(void *s, int c, size_t n);
extern void memswab(const char *src, char *dest, int count);
extern void memflip8x8(const byte *inp, int line_size, byte *outp, int dist);
extern const char   *gs_error_names[];
		 
		 
typedef ref   *os_ptr;
extern os_ptr osbot, osp, ostop;
typedef int (*op_proc_p)(os_ptr );
typedef struct {
	const char   *oname;
	op_proc_p proc;
	int   *oindex;
} op_def;
typedef op_def const   *op_def_ptr;
extern op_def_ptr *op_def_table;
extern uint op_def_count;
extern ref op_array_table;		 
extern ushort *op_array_nx_table;
extern uint op_array_count;
extern int bytes_compare(const byte *, uint, const byte *, uint );
extern int string_match(const byte *str, uint len, const byte *pstr, uint plen, int ignore_case );
extern uint string_hash(const byte *, uint );
struct gs_prop_item_s;
extern int props_extract(
	struct gs_prop_item_s *plist,	
	int count,
	const struct gs_prop_item_s *template, 
					
	int tcount,
	struct gs_prop_item_s **pknown,	
					
					
					
	int finished			
					
 );
extern void refcpy_to_new(ref *to, const ref *from, uint size );
extern void refcpy_to_old(ref *to, const ref *from, uint size, const char *client_name );
extern void refset_null(ref *to, uint size );
extern int obj_eq(const ref *, const ref * );
extern int obj_cvs(const ref *, byte *, uint, uint * );
extern int string_to_ref(const char *, ref *, const char * );
extern char *ref_to_string(const ref *, const char * );
extern int num_params(const ref *, int, float * );
extern int real_param(const ref *, float * );
struct gs_matrix_s;
extern int read_matrix(const ref *, struct gs_matrix_s * );
extern int write_matrix(ref * );
typedef struct {
	const char   *vname;
	ref   *pvref;
} names_def;
extern void init_names(const names_def   * );
extern os_ptr osp_nargs[6 ];
void	alloc_init(proc_alloc_t, proc_free_t, uint );
char	*alloc(uint num_elts, uint elt_size, const char *client_name );
void	alloc_free(char *data, uint num_elts, uint elt_size, const char *client_name );
void	alloc_status(long *, long * );
byte	*alloc_grow(byte *data, uint old_num, uint new_num, uint elt_size, const char *client_name );
byte	*alloc_shrink(byte *data, uint old_num, uint new_num, uint elt_size, const char *client_name );
typedef ref   *es_ptr;
extern es_ptr esbot, esp, estop;
extern es_ptr esfile;
typedef struct gs_matrix_s {
	long _xx  ; float xx;	long _xy  ; float xy;	long _yx  ; float yx;	long _yy  ; float yy;	long _tx  ; float tx;	long _ty  ; float ty ;
} gs_matrix;
void	gs_make_identity(gs_matrix * );
int	gs_make_translation(floatp, floatp, gs_matrix * ),
	gs_make_scaling(floatp, floatp, gs_matrix * ),
	gs_make_rotation(floatp, gs_matrix * );
int	gs_matrix_multiply(const gs_matrix *, const gs_matrix *, gs_matrix * ),
	gs_matrix_invert(const gs_matrix *, gs_matrix * ),
	gs_matrix_rotate(const gs_matrix *, floatp, gs_matrix * );
int	gs_point_transform(floatp, floatp, const gs_matrix *, gs_point * ),
	gs_point_transform_inverse(floatp, floatp, const gs_matrix *, gs_point * ),
	gs_distance_transform(floatp, floatp, const gs_matrix *, gs_point * ),
	gs_distance_transform_inverse(floatp, floatp, const gs_matrix *, gs_point * ),
	gs_bbox_transform_inverse(gs_rect *, gs_matrix *, gs_rect * );
 	 
typedef enum {
	gs_cap_butt = 0,
	gs_cap_round = 1,
	gs_cap_square = 2
} gs_line_cap;
typedef enum {
	gs_join_miter = 0,
	gs_join_round = 1,
	gs_join_bevel = 2
} gs_line_join;
gs_state *gs_state_alloc(proc_alloc_t, proc_free_t );  
int	gs_state_free(gs_state * );
int	gs_gsave(gs_state * ),
	gs_grestore(gs_state * ),
	gs_grestoreall(gs_state * );
gs_state *gs_gstate(gs_state * );
int	gs_currentgstate(gs_state * , const gs_state *  ),
	gs_setgstate(gs_state * , const gs_state *  );
gs_state *gs_state_swap_saved(gs_state *, gs_state * );	 
void	gs_state_swap(gs_state *, gs_state * );	 
int	gs_initgraphics(gs_state * );
typedef struct gx_device_s gx_device;
int	gs_flushpage(gs_state * );
int	gs_copypage(gs_state * );
int	gs_output_page(gs_state *, int, int );
int	gs_copyscanlines(gx_device *, int, byte *, uint, int *, uint * );
gx_device *	gs_getdevice(int );
int	gs_copydevice(gx_device **, gx_device *, proc_alloc_t );
int	gs_makeimagedevice(gx_device **, gs_matrix *, uint, uint, byte *, int, proc_alloc_t );
void	gs_nulldevice(gs_state * );
int	gs_setdevice(gs_state *, gx_device * );
gx_device *	gs_currentdevice(gs_state * );
const char *	gs_devicename(gx_device * );
void	gs_deviceinitialmatrix(gx_device *, gs_matrix * );
int	gs_closedevice(gx_device * );
int	gs_setlinewidth(gs_state *, floatp );
float	gs_currentlinewidth(const gs_state * );
int	gs_setlinecap(gs_state *, gs_line_cap );
gs_line_cap	gs_currentlinecap(const gs_state * );
int	gs_setlinejoin(gs_state *, gs_line_join );
gs_line_join	gs_currentlinejoin(const gs_state * );
int	gs_setmiterlimit(gs_state *, floatp );
float	gs_currentmiterlimit(const gs_state * );
int	gs_setdash(gs_state *, const float *, uint, floatp );
uint	gs_currentdash_length(const gs_state * );
int	gs_currentdash_pattern(const gs_state *, float * );
float	gs_currentdash_offset(const gs_state * );
int	gs_setflat(gs_state *, floatp );
float	gs_currentflat(const gs_state * );
int	gs_setstrokeadjust(gs_state *, int );
int	gs_currentstrokeadjust(const gs_state * );
typedef enum {
	gs_color_space_DeviceGray = 0,
	gs_color_space_DeviceRGB,
	gs_color_space_DeviceCMYK	 
} gs_color_space;
typedef struct gs_color_s gs_color;
extern const uint gs_color_sizeof;
int	gs_setgray(gs_state *, floatp );
float	gs_currentgray(gs_state * );
int	gs_sethsbcolor(gs_state *, floatp, floatp, floatp ),
	gs_currenthsbcolor(gs_state *, float [3] ),
	gs_setrgbcolor(gs_state *, floatp, floatp, floatp ),
	gs_currentrgbcolor(gs_state *, float [3] );
int	gs_currentcolorspace(gs_state *, gs_color_space * );
typedef float (*gs_transfer_proc)(gs_state *, floatp );
int	gs_settransfer(gs_state *, gs_transfer_proc ),
	gs_settransfer_remap(gs_state *, gs_transfer_proc, int );
gs_transfer_proc	gs_currenttransfer(gs_state * );
int	gs_setcolortransfer(gs_state *, gs_transfer_proc ,
			gs_transfer_proc , gs_transfer_proc ,
			gs_transfer_proc  ),
	gs_setcolortransfer_remap(gs_state *, gs_transfer_proc ,
			gs_transfer_proc , gs_transfer_proc ,
			gs_transfer_proc , int );
void	gs_currentcolortransfer(gs_state *, gs_transfer_proc [4] );
int	gs_setscreen(gs_state *, floatp, floatp, float (*)(floatp, floatp ) );
int	gs_currentscreen(gs_state *, float *, float *, float (**)(floatp, floatp ) );
int	gs_sethalftonephase(gs_state *, int, int );
int	gs_currenthalftonephase(gs_state *, gs_int_point * );
typedef struct gs_screen_enum_s gs_screen_enum;
extern const uint gs_screen_enum_sizeof;
int	gs_screen_init(gs_screen_enum *, gs_state *, floatp, floatp );
int	gs_screen_currentpoint(gs_screen_enum *, gs_point * );
int	gs_screen_next(gs_screen_enum *, floatp );
typedef struct int_gstate_s int_gstate;
struct int_gstate_s {
		 
	ref screen_proc;		 
	struct {
		ref red, green, blue, gray;	 
	} transfer_procs;
	ref font;			 
	int_gstate *saved;		 
};
extern int_gstate istate;
extern gs_state *igs;
	 
	 
extern int alloc_save_new_mask;		 
extern int alloc_save_test_mask;	 
extern int alloc_save_change(ref *ptr, const char *client_name );
extern ref *alloc_refs(uint num_refs, const char *client_name );
static  int screen_sample(os_ptr );
static  int set_screen_continue(os_ptr );
static  int i_set_screen_continue;
int
zcurrenthalftonephase(register os_ptr op)
{	gs_int_point phase;
	gs_currenthalftonephase(igs, &phase);
	if ( (osp = op += (2)) > ostop ) return (osp -= (2), (-16) ) ;
	((op - 1)->value. intval = (  phase.x), ((op - 1)->tas.type_attrs = ((  t_integer) << 7 ) + ( 0)) )   ;
	((op)->value. intval = (  phase.y), ((op)->tas.type_attrs = ((  t_integer) << 7 ) + ( 0)) )   ;
	return 0;
}
int
zcurrentscreen(register os_ptr op)
{	float freq, angle;
	float (*proc)(floatp, floatp );
	gs_currentscreen(igs, &freq, &angle, &proc);
	if ( (osp = op += (3)) > ostop ) return (osp -= (3), (-16) ) ;
	((op - 2)->value. realval = (  freq), ((op - 2)->tas.type_attrs = ((  t_real) << 7 ) + ( 0)) )   ;
	((op - 1)->value. realval = (  angle), ((op - 1)->tas.type_attrs = ((  t_real) << 7 ) + ( 0)) )   ;
	*op = istate.screen_proc;
	return 0;
}
int
zsethalftonephase(register os_ptr op)
{	int code;
	long x, y;
	if ( !(((&op[-1])->tas.type_attrs & ((((1 << 6 ) - 1) << 7 ) + (0))) == ((( t_integer) << 7 ) + (0))) 	 ) return (-20)  ;
	if ( !(((&*op)->tas.type_attrs & ((((1 << 6 ) - 1) << 7 ) + (0))) == ((( t_integer) << 7 ) + (0))) 	 ) return (-20)  ;
	x = op[-1].value.intval;
	y = op->value.intval;
	if ( x != (int)x || y != (int)y )
		return (-15) ;
	code = gs_sethalftonephase(igs, (int)x, (int)y);
	if ( code >= 0 ) (osp -= (2)) ;
	return code;
}
int
zsetscreen(register os_ptr op)
{	float fa[2];
	int code = num_params(op - 1, 2, fa);
	gs_screen_enum *penum;
	if ( code < 0 ) return code;
	switch ( (((&*op)->tas.type_attrs) >> (7  - 2))   ) { default:	return(!(~((&*op)->tas.type_attrs)	 & ( 0x20  + 0x40 ))  ? (-20)  :	(-7) ); case ((((t_array) << 7 ) + ( 0x20  + 0x40 )) >> (7  - 2))  : case ((((t_mixedarray) << 7 ) + ( 0x20  + 0x40 )) >> (7  - 2))  : case ((((t_shortarray) << 7 ) + ( 0x20  + 0x40 )) >> (7  - 2))  : ; } ;
	penum = (gs_screen_enum *)alloc(1, gs_screen_enum_sizeof, "setscreen");
	if ( penum == 0 ) return (-25) ;
	code = gs_screen_init(penum, igs, fa[0], fa[1]);
	if ( code < 0 )
	   {	alloc_free((char *)penum, 1, gs_screen_enum_sizeof, "setscreen");
		return code;
	   }
	 
	if ( esp + (3 ) > estop ) return (-5)  ;
	(++esp, ((esp)->value. index = (  0			), ((esp)->tas.type_attrs = ((  t_null) << 7 ) + (  0x40 )) )  ) ;
	*++esp = *op;			 
	++esp;
	(((esp)->value. bytes = ( (byte *)penum), ((esp)->tas.type_attrs = ((  t_string) << 7 ) + (  0)) ) , ((esp)->tas.rsize = (  gs_screen_enum_sizeof)) ) ;
	(osp -= (3)) ;  op -= 3;
	return screen_sample(op);
}
static  int
screen_sample(register os_ptr op)
{	gs_screen_enum *penum = (gs_screen_enum *)esp->value.bytes ;
	gs_point pt;
	int code = gs_screen_currentpoint(penum, &pt);
	ref proc;
	if ( code < 0 ) return code;
	if ( code != 0 )
	   {	 
		istate.screen_proc = esp[-1] ;
		esp -= 3 ;
		return 8 ;
	   }
	if ( (osp = op += (2)) > ostop ) return (osp -= (2), (-16) ) ;
	((op - 1)->value. realval = (  pt.x), ((op - 1)->tas.type_attrs = ((  t_real) << 7 ) + ( 0)) )   ;
	((op)->value. realval = (  pt.y), ((op)->tas.type_attrs = ((  t_real) << 7 ) + ( 0)) )   ;
	proc = esp[-1] ;
	(++esp, (((esp)->value. opproc = (  (dummy_op_proc_p)( set_screen_continue)), ((esp)->tas.type_attrs = ((  t_operator) << 7 ) + (  0x40 )) ) , ((esp)->tas.rsize = (     i_set_screen_continue)) )   ) ;
	*++esp = proc;
	return 3 ;
}
static  int
set_screen_continue(register os_ptr op)
{	float value;
	int code = num_params(op, 1, &value);
	if ( code < 0 ) return code;
	code = gs_screen_next((gs_screen_enum *)esp->value.bytes , value);
	if ( code < 0 ) return code;
	(osp -= (1)) ;  op--;
	return screen_sample(op);
}
op_def zht_op_defs[] = {
	{"0currenthalftonephase", zcurrenthalftonephase},
	{"0currentscreen", zcurrentscreen},
	{"2sethalftonephase", zsethalftonephase},
	{"3setscreen", zsetscreen},
		 
	{"1%set_screen_continue", set_screen_continue, &i_set_screen_continue},
	{(char   *)0, (op_proc_p)0} 
};
----------------8<------------end of zht.c----------------------

Good Luck!

...Tim

          Tim Theisen           Systems Programmer
Internet: tim@cs.wisc.edu       Department of Computer Sciences
    UUCP: uwvax!tim             University of Wisconsin-Madison
   Phone: (608)262-0438         1210 West Dayton Street
     FAX: (608)262-9777         Madison, WI   53706
Technical Details
Message-ID: <9211091622.AA09962@appenzell.cs.wisc.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!agate!spool.mu.edu!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cs.wisc.edu!tim

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!agate!spool.mu.edu!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cs.wisc.edu!tim
From: tim@cs.wisc.edu (Tim Theisen)
Subject: Internal compiler error for gcc-2.3.1 on romp-ibm-aos.
Message-ID: <9211091622.AA09962@appenzell.cs.wisc.edu>
Sender: gnulists@ai.mit.edu
Organization: University of Wisconsin-Madison, Department of Computer Sciences
Distribution: gnu
Date: Mon, 9 Nov 1992 04:22:35 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 493