[cfe-dev] Patch for union bit field crash

Sachin.Punyani at microchip.com Sachin.Punyani at microchip.com
Fri Nov 6 02:01:55 PST 2009


Hi,

 

Please consider the case.

 

union  u {

   unsigned i : 3

}uvar;

 

Some more information

----------------------------------

Size of int - 2 bytes 

Alignment of int - 1 byte

Size of char - 1 byte

Alignment of char - 1 byte

 

The field size is 3 and it should be accommodated in char. However there
is an assertion failure in clang. (Options : --emit-llvm-bc
--triple=pic16 ; the above information for size and alignment is from
PIC16)

 

Please find the patch attached for this fix. Please provide your
feedback on this. 

 

Regards

Sachin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20091106/899f4860/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: union_layout.patch
Type: application/octet-stream
Size: 1635 bytes
Desc: union_layout.patch
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20091106/899f4860/attachment.obj>


More information about the cfe-dev mailing list