trq@MOOSE.CITA.UTORONTO.CA (Tom Quinn) (12/02/88)
Gcc compiles the following code into assembly that will cause a data misalignment signal. This gcc version 1.31 on a sun4/110 running SunOS 4.0. Tom Quinn Canadian Institute for Theoretical Astrophysics trq@moose.cita.utoronto.ca UUCP - decvax!utgpu!moose!trq BITNET - quinn@utorphys.bitnet ARPA - trq%moose.cita.toronto.edu@relay.cs.net The compile: gcc -S -g -v -sun4 -c Convert.c gcc version 1.31 /usr/local/lib/gcc-cpp -v -undef -D__GNU__ -D__GNUC__ -Dsparc -Dsun -Dunix Convert.c /tmp/cca17790.cpp GNU CPP version 1.31 /usr/local/lib/gcc-cc1 /tmp/cca17790.cpp -quiet -dumpbase Convert.c -g -version -o Convert.s GNU C version 1.31 (sparc) compiled by GNU C version 1.31. The offending assembler: .stabn 68,0,43,LM11 LM11: ld [%fp+84],%o0 ldd [%l1+28],%l4 <<This instruction will fault std %l4,[%o0] <<This one will too The code: typedef char * caddr_t; typedef struct { unsigned int size; caddr_t addr; } XrmValue, *XrmValuePtr; typedef unsigned int Cardinal; typedef (*XtConverter)(); typedef struct _CacheRec *CachePtr; typedef struct _CacheRec { CachePtr next; int hash; XtConverter converter; XrmValue *args; Cardinal num_args; XrmValue from; XrmValue to; } CacheRec; typedef CachePtr CacheHashTable[256 ]; static CacheHashTable cacheHashTable; void XtDirectConvert(converter, args, num_args, from, to) XtConverter converter; XrmValuePtr args; Cardinal num_args; register XrmValuePtr from; XrmValuePtr to; { register CachePtr p; register int hash; register Cardinal i; hash = ((int)(converter) >> 2) + from->size + *((char *) from->addr); if (from->size > 1) hash += ((char *) from->addr)[1]; for (p = cacheHashTable[hash & 255 ]; p != 0 ; p = p->next) { if ((p->hash == hash) && (p->converter == converter) && (p->from.size == from->size) && (p->num_args == num_args)) { for (i = 0; i < num_args; i++) { if ( p->args[i].size != args[i].size ) { break; } } if (i == num_args) { (*to) = p->to; return; } } } (*to).size = 0; (*to).addr = 0 ; (*converter)(args, &num_args, from, to); CacheEnter(converter, args, num_args, from, to, hash); }
trq@MOOSE.CITA.UTORONTO.CA (Tom Quinn) (12/04/88)
The following code causes gcc to get a fatal signal. This is gcc version 1.31 on a sun 4/110 running SUNOS 4.0. The compile: gcc -g -v -S -sun4 -c control2.c gcc version 1.31 /usr/local/lib/gcc-cpp -v -undef -D__GNU__ -D__GNUC__ -Dsparc -Dsun -Dunix control2.c /tmp/cca18106.cpp GNU CPP version 1.31 /usr/local/lib/gcc-cc1 /tmp/cca18106.cpp -quiet -dumpbase control2.c -g -version -o control2.s GNU C version 1.31 (sparc) compiled by GNU C version 1.31. gcc: Program cc1 got fatal signal 6. The code: ------------------------------------------------------------ typedef struct { char descrip[80], *name; float *vec; int dimen; } VECTOR; typedef union yystype { char charval[80]; int intval; }; extern union yystype yylval; static char data_file[80]; union yystype yylval; int yyparse() { register union yystype *yyvsp; union yystype yyvsa[200 ]; union yystype *yyvs = yyvsa; yyvsp = yyvs; *++yyvsp = yylval; { VECTOR temp; if(read_row(data_file,yyvsp[0].intval,&temp) == 0) { copy_vector(yyvsp[-1].charval,temp); } ; } }