Article View: gnu.gcc.bug
Article #1730bug in sparc gcc 1.28
From: Tom Quinn
Date: Fri, 30 Sep 1988 13:51
Date: Fri, 30 Sep 1988 13:51
82 lines
2902 bytes
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);
}
Technical Details
Message-ID:
<8809301351.AA05103@moose.cita.toronto.edu>Path:
arc1-ca.pugleaf.net!utzoo!telly!ddsw1!mcdchg!rutgers!tut.cis.ohio-state.edu!moose.cita.toronto.edu!trqShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!mcdchg!rutgers!tut.cis.ohio-state.edu!moose.cita.toronto.edu!trq From: trq@moose.cita.toronto.edu (Tom Quinn) Newsgroups: gnu.gcc.bug Subject: bug in sparc gcc 1.28 Message-ID: <8809301351.AA05103@moose.cita.toronto.edu> Date: 30 Sep 88 13:51:57 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 82