[PATCH] Non-POD unions with bit-fields causes an assertion failure at clang/lib/AST/RecordLayoutBuilder.cpp:754

Evgeny Astigeevich evgeny.astigeevich at arm.com
Tue Oct 14 08:34:29 PDT 2014


The following program:

union A {
  int f1: 3;
  A();
};

A::A() {}

causes the failure of the assertion "DataSize % Context.getCharWidth() == 0" at clang/lib/AST/RecordLayoutBuilder.cpp:754.

It happens because '2.4 Non-POD Class Types/II. Allocation of Members Other Than Virtual Bases/1. bit-fileds' of C++ ABI (http://mentorembedded.github.io/cxx-abi/abi.html#class-types) is implemented incorrectly: dsize(C) is not updated to include the last byte containing (part of) the bitfield.

http://reviews.llvm.org/D5775

Files:
  lib/AST/RecordLayoutBuilder.cpp
  test/Layout/union_regular_bit_field.cpp
  test/Layout/union_wide_bit_field.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5775.14870.patch
Type: text/x-patch
Size: 3031 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141014/e1942c28/attachment.bin>


More information about the cfe-commits mailing list