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

Duncan Sands baldrick at free.fr
Tue Apr 17 23:15:29 PDT 2007


Hi Devang,

> if
> 	(StartOffsetInBits > FirstUnallocatedByte*8)
> 
> is true then
> 	
> 	(StartOffsetFromByteBoundry == 0)
> 
> is always true. If so, we could simply this even further. In other  
> words, if we need pad bytes for a new field then it always starts at  
> byte boundary. Can you think of an example where this is not true ?

yes, this need not be true in Ada, where bitfields can be placed
wherever you like, 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;
   -- "gaps__second_bitfield_not_at_bitoffset_zero", size 72
   --   Fields:
   --     "a", size  8, offset 0, bit offset 0
   --     "b", size 32, offset 0, bit offset 27

Best wishes,

Duncan.



More information about the llvm-commits mailing list