🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Tom Quinn Fri, 30 Sep 1988 13:51
bug in sparc gcc 1.28
#1730
Author: Tom Quinn
Date: Fri, 30 Sep 1988 13:51
82 lines
2902 bytes
Gcc compiles the following code into assembly that will cause a data
misalignment signal.  This gcc version 1.28 on a sun4/110 running
SunOS 4.0.

Tom Quinn                 Canadian Institute for Theoretical Astrophysics
trq@moose.cita.toronto.edu
SOON TO BE 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.28
 /usr/local/lib/gcc-cpp -v -undef -D__GNU__ -D__GNUC__ -Dsparc -Dsun -Dunix Convert.c /tmp/cca26062.cpp
GNU CPP version 1.28
 /usr/local/lib/gcc-cc1 /tmp/cca26062.cpp -quiet -dumpbase Convert.c -g -version -o Convert.s
GNU C version 1.28 (sparc) compiled by GNU C version 1.28.

The offending assembler:
.stabn 68,0,43,LM11
LM11:
	ld [%fp+84],%o0
	ldd [%l1+28],%l4	<<<ldd requires operands to be 8-byte
				   aligned, which is not the case here.
	std %l4,[%o0]		<<<this instruction also loses


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);
}
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads