This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: GCC endless loop for store_bit_field with alignment 0
- To: gcc-bugs at gcc dot gnu dot org
- Subject: Re: GCC endless loop for store_bit_field with alignment 0
- From: David Edelsohn <dje at watson dot ibm dot com>
- Date: Thu, 10 Aug 2000 17:55:51 -0400
- cc: Geoff Keating <geoffk at cygnus dot com>, Richard Henderson <rth at cygnus dot com>
In my previous note I mis-typed my proposed change to
expmed.c:store_split_bit_field(). It should have been:
if (GET_CODE (op0) == REG || GET_CODE (op0) == SUBREG)
unit = BITS_PER_WORD;
else
unit = MAX (MIN (align, BITS_PER_WORD), BITS_PER_UNIT);
However, that still does not solve the problem because
store_split_bit_field() calls store_fixed_bit_field() which calls
get_best_mode() with alignment 0. get_best_mode() returns VOIDmode
because the alignment is 0, so store_fixed_bit_field() performs:
if (mode == VOIDmode)
{
/* The only way this should occur is if the field spans word
boundaries. */
store_split_bit_field (op0,
bitsize, bitpos + offset * BITS_PER_UNIT,
value, struct_align);
which places GCC into infinite recursion between store_fixed_bit_field()
and store_split_bit_field(). (This same recursion occurs in the original
case, but with bitsize equal to 0, store_split_bit_field() succeeds in
moving zero bits.)
Basically store_fixed_bit_field() and store_split_bit_field()
combination are not robust in the face of zero alignment. And, I do not
understand why the alignment of this object is zero.
GCC probably should abort much earlier in the case of zero
alignment as a self-check, but I am not sure how high up the call chain.
expmed.c:store_bit_field()? expr.c:store_field()?
expr.c:expand_assignment()?
Thanks, David
P.S. This is relative to the 2000-08-08 tree.