Thread View: gnu.gcc.bug
1 messages
1 total messages
Started by Andreas Schwab
Mon, 14 Dec 1992 11:47
GCC 2.3.2: Bug in combiner
Author: Andreas Schwab
Date: Mon, 14 Dec 1992 11:47
Date: Mon, 14 Dec 1992 11:47
63 lines
2016 bytes
2016 bytes
GCC 2.3.2 (m68k, Atari TT) generates wrong code for this function:
-------------------- x.c
struct rect { short x, y, w, h; };
f (struct rect r)
{
short x[4];
x[0] = r.x;
x[1] = r.y;
x[2] = r.x + r.w - 1;
x[3] = r.y + r.h - 1;
g (x);
}
--------------------
when compiled with: gcc -S -O2 x.c
-------------------- x.s
#NO_APP
gcc2_compiled.:
.text
.even
.globl _f
_f:
link a6,#-8
movel d2,sp@-
movel a6@(8),d1
movel a6@(12),d2
bfexts d1{#0:#16},d0
movew d0,a6@(-8)
movew d1,a6@(-6)
addw d2,d0 | <-- d2 should be upper half of d2
subqw #1,d0
movew d0,a6@(-4)
addw d2,d1
subqw #1,d1
movew d1,a6@(-2)
pea a6@(-8)
jbsr _g
movel a6@(-12),d2
unlk a6
rts
--------------------
I guess that the bug is in combine.c:num_sign_bit_copies near line 6454:
--------------------
/* If we haven't been able to figure it out by one of the above rules,
see if some of the high-order bits are known to be zero. If so,
count those bits and return one less than that amount. If we can't
safely compute the mask for this mode, always return BITWIDTH. */
if (bitwidth > HOST_BITS_PER_WIDE_INT)
return bitwidth;
--------------------
This seems wrong. If the number of sign bit copies cannot be computed,
the value for the worst case should be returned, which is 1.
If this is changed, the above example compiles correctly.
--
Andreas Schwab
schwab@ls5.informatik.uni-dortmund.de
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