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

Richard Trieu rtrieu at google.com
Mon May 13 18:22:50 PDT 2013



================
Comment at: lib/AST/ASTContext.cpp:1358
@@ +1357,3 @@
+  unsigned Align = EltInfo.second / CharWidth;
+  Width = llvm::RoundUpToAlignment(Width, Align);
+  return std::make_pair(CharUnits::fromQuantity(Width),
----------------
Richard Smith wrote:
> This shouldn't be necessary; EltInfo.first / CharWidth should have been a multiple of EltInfo.second / CharWidth. Maybe convert this to an assertion?
This was added in revision 130242
http://llvm.org/viewvc/llvm-project?view=revision&revision=130242

in response to PR5637
http://llvm.org/bugs/show_bug.cgi?id=5637

where Clang was changed to follow the behavior of GCC.  Otherwise, omitting this line will cause test/Sema/align-x86.c and test/Sema/align-x86-64.c to fail.


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



More information about the cfe-commits mailing list