[llvm-commits] [126245] Fix http://lists.cs.uiuc.edu/pipermail/llvm-commits/ Week-of-Mon-20070416/047943.html

Duncan Sands baldrick at free.fr
Thu Apr 19 11:51:58 PDT 2007


Hi Devang,

> > yes, this need not be true in Ada, where bitfields can be placed
> > wherever you like,
> 
> Is it true for very first bitfield also ?

yes, it is true for all bitfields including the first.

> > for example
> >
> >   type Second_Bitfield_Not_At_Bitoffset_Zero is record
> >      A : Character;
> >      B : Integer;
> >   end record;
> >   for Second_Bitfield_Not_At_Bitoffset_Zero use record
> >      A at 0 range 0 .. 7;
> >      B at 0 range 27 .. 64;
> >   end record;
> 
> so here, range is not value  range. In that case size of B
> should be 64. No?

Here the range for B is 38 bits, which is enough to contain
the 32 bits of an integer.  The bit range needs to be at
least as wide as the type, it cannot be smaller.  This code
is perfectly legal and works fine with gcc.  That said, it
was a typo, I didn't mean to write 27..64, but 27..58.

Ciao,

Duncan.



More information about the llvm-commits mailing list