This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC/RFA: patch for PR 22156: improve SRA for bit-fields


On Tue, Mar 20, 2007 at 06:50:45AM -0300, Alexandre Oliva wrote:
> +      unsigned HOST_WIDE_INT nbit, nsize;
> +
> +      nbit = tree_low_cst (DECL_FIELD_BIT_OFFSET (f), 1);
> +      nsize = tree_low_cst (DECL_SIZE (f), 1);
> +
> +      if (bit + size == nbit)
> +	{
> +	  if ((bit & alchk) != ((nbit + nsize - 1) & alchk))
> +	    break;
> +	  size += nsize;
> +	}
> +      else if (nbit + nsize == bit)
> +	{
> +	  if ((nbit & alchk) != ((bit + size - 1) & alchk))
> +	    break;
> +	  bit = nbit;

How is it right to modify bit but not size?

Any reason to require that the bit fields be actually sequential?
It seems to me that

	struct S {
	  unsigned a : 1;
	  unsigned   : 1;
	  unsigned b : 1;
	};

needn't actually represent the unnamed (and unused) field in the
type description, so long as B has the correct values in 
DECL_FIELD_BIT_OFFSET &c.



r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]