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

Richard Smith richard at metafoo.co.uk
Mon May 13 19:10:25 PDT 2013


On Mon, May 13, 2013 at 6:22 PM, Richard Trieu <rtrieu at google.com> wrote:

>
>
> ================
> 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.


Wow. That's impressively broken. OK then!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130513/ea964a8e/attachment.html>


More information about the cfe-commits mailing list