This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
bug in recent function.c change
- To: rth at cygnus dot com
- Subject: bug in recent function.c change
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Thu, 01 Oct 1998 19:51:15 -0600
- Cc: egcs-bugs at cygnus dot com
- Reply-To: law at cygnus dot com
This change:
revision 1.45
date: 1998/09/30 18:04:51; author: rth; state: Exp; lines: +1 -1
Typo in last commit.
----------------------------
revision 1.44
date: 1998/09/30 18:03:48; author: rth; state: Exp; lines: +80 -12
* function.c (purge_addressof_1): Use bitfield manipulation
routines to handle mem mode < reg mode.
Is causing problems on the PA (and I suspect any other big endian machine).
The attached testcase compiled with -O2 for an hppa1.1-hp-hpux target will
exhibit the problem:
In the .cse dump we have:
(insn 202 199 203 (set (reg:QI 128)
(mem/s:QI (addressof:SI (reg/v:SI 99) 95) 0)) 94 {movqi+1} (nil)
(nil))
Which gets turned into this in the .addressof dump:
(insn 202 199 203 (set (reg:QI 128)
(mem/s:QI (plus:SI (reg:SI 3 %r3)
(const_int 11)) 0)) 94 {movqi+1} (nil)
(nil))
Which I suppose is correct if we happened to be compiling for a little endian
target :-)
If I back off function.c to rev 1.43, I get the following in the .addressof
dump, which is correct:
(insn 202 199 203 (set (reg:QI 128)
(mem/s:QI (plus:SI (reg:SI 3 %r3)
(const_int 8)) 0)) 94 {movqi+1} (nil)
(nil))
I think you've got an endianness problem in your change.
jeff
typedef int int32_t;
typedef int32_t off_t;
static int debug;
static void
mybytemap(map)
int map[];
{
union {
off_t o;
char c[(sizeof(off_t)) ];
} u;
register int *mp = &map[(sizeof(off_t)) ];
register int ntodo;
register int i;
u.o = 1;
for (ntodo = (int)(sizeof(off_t)) ; ntodo > 0; ntodo--) {
for (i = 0; i < (sizeof(off_t)) ; i++)
if (u.c[i] != 0)
break;
if (i == (sizeof(off_t)) ) {
if (debug) { (void) _IO_printf ("mybytemap: nonexistent byte %d!!!\n", ntodo) ; } ;
for (i = 0; i < (sizeof(off_t)) ; i++)
map[i] = i;
return;
}
if (debug) { (void) _IO_printf ("mybytemap: byte %d\n", i) ; } ;
*--mp = i;
while (u.c[i] != 0)
u.o <<= 1;
}
}