[PATCH] Perform calculation of array size in chars instead of bits to prevent an assertion.

Richard Trieu rtrieu at google.com
Mon May 13 15:05:02 PDT 2013



================
Comment at: test/Sema/offsetof.c:77-80
@@ +76,6 @@
+
+struct Chunk {
+  char padding[Size];
+  char data;
+};
+
----------------
Richard Smith wrote:
> Does sizeof(Chunk) work here? Or 'char padding[1][Size];'? I suspect we'll need a more comprehensive solution to this problem -- perhaps reformulating the whole computation in terms of CharUnits.
sizeof(Chunk) works.  char padding[1][Size] will trigger the original assertion without using __builtin_offsetof or sizeof().  


http://llvm-reviews.chandlerc.com/D781



More information about the cfe-commits mailing list