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: Geoff Keating <geoffk at cygnus dot com>
- 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 20:02:20 -0400
- cc: gcc-bugs at gcc dot gnu dot org, rth at cygnus dot com
>>>>> Geoff Keating writes:
Geoff> The problem is that DECL_FIELD_OFFSET_ALIGN overflows, because it's
Geoff> only an 8-bit-wide bitfield in the tree structure. I posted a patch to
Geoff> store this field as a power of two, giving alignments of up to 2^256,
Geoff> which ought to be enough.
Why are such large alignments necessary? The largest alignment
that one ever needs is BIGGEST_ALIGNMENT which is less than 256 on all
targets (128 is the largest that I see). A pervasive change to
powers-of-2 now does provide headroom when we port GCC to 128-bit
processors.
Index: stor-layout.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/stor-layout.c,v
retrieving revision 1.79
diff -c -p -r1.79 stor-layout.c
*** stor-layout.c 2000/06/24 19:26:42 1.79
--- stor-layout.c 2000/08/10 23:56:55
*************** place_field (rli, field)
*** 859,865 ****
normalize_rli (rli);
DECL_FIELD_OFFSET (field) = rli->offset;
DECL_FIELD_BIT_OFFSET (field) = rli->bitpos;
! DECL_OFFSET_ALIGN (field) = rli->offset_align;
/* If this field ended up more aligned than we thought it would be (we
approximate this by seeing if its position changed), lay out the field
--- 859,865 ----
normalize_rli (rli);
DECL_FIELD_OFFSET (field) = rli->offset;
DECL_FIELD_BIT_OFFSET (field) = rli->bitpos;
! DECL_OFFSET_ALIGN (field) = MIN (rli->offset_align, BIGGEST_ALIGNMENT);
/* If this field ended up more aligned than we thought it would be (we
approximate this by seeing if its position changed), lay out the field
David