On Tue, 7 Feb 2012, Richard Guenther wrote:

> That would be nice.  I suppose that doing
> 
>       if (DECL_INITIAL (x))
>         {
>           unsigned HOST_WIDE_INT width = tree_low_cst (DECL_INITIAL (x), 
> 1);
>           DECL_SIZE (x) = bitsize_int (width);
>           DECL_BIT_FIELD (x) = 1;
>           SET_DECL_C_BIT_FIELD (x);
>         }
> 
> at the time we set DECL_INITIAL to the width is not possible
> for some weird reason?  At least the struct-layout-1.exp tests
> seem to be happy with

I don't know, but given how many ABI variations there are it would need a 
lot of testing and understanding how DECL_SIZE and DECL_BIT_FIELD may be 
used.  Just setting DECL_C_BIT_FIELD early, and keeping the width 
somewhere separate, seems safer (although uses still need to be checked).

For C++ the width may depend on a template parameter so the integer value 
can't be determined immediately at parse time.

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to