This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the EGCS project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Followup:
This is the simplist reduction of the code that causes the Optimization
error,
if u remove the "l = (((struct varlena *)( v ))->vl_len) "
statement then the compiled ( with cc -S -O1 ) appears to be more
correct.
If u leave it in, then the *v++ gets screwed up.
gat
typedef signed int int32;
struct varlena { int32 vl_len; char vl_dat[1]; };
typedef union nameData
{ char data[32 ]; int alignmentDummy;
} NameData;
typedef NameData *Name;
static long comphash(long l, char *v);
static long
comphash(long l, char *v)
{
long i;
NameData n;
if (l < 0)
l = (((struct varlena *)( v ))->vl_len) ;
i = 0;
while (l--)
i += *v++;
return i;
}
~
- To: gcc-bugs@gcc.gnu.org
- Subject: egcs 112 & alpha & bad -O1 optimization
- From: Uncle George <gatgul@voicenet.com>
- Date: Thu, 29 Jul 1999 13:12:12 -0400
- Organization: Big Endian
The following attached preprocessed 'f.c' from postgresql failes to properly compile with -O1. In particular the char *v in the argument list of comphash appears to get translated into a long * the particular errant code segment from comphash() is : while (l--) i += *v++; which appear to get xlated into assembler: $L205: ldl $1,0($0) sll $1,56,$1 sra $1,56,$1 addq $2,$1,$2 addq $0,1,$0 subq $9,1,$9 cmpeq $9,$3,$1 beq $1,$L205 unfortunately this does not do very well for the *v, which gets an alignment fault! gat
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |