r289413 - Add two new AST nodes to represent initialization of an array in terms of

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 13 11:56:33 PST 2016


Aha, you have activated the win32 stack alignment trap card. By adding a
uint64_t to EvalInfo, you have increased its alignment to 8. Unfortunately,
MSVC doesn't actually align stack objects to more than 4 unless you really
ask it to with __declspec(align). Normally this stuff flies under the
radar, but PointerUnion makes assertions about alignment. A possible fix:

diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp
index 61bb2b9..e18caff 100644
--- a/lib/AST/ExprConstant.cpp
+++ b/lib/AST/ExprConstant.cpp
@@ -433,7 +433,7 @@ namespace {
   /// rules.  For example, the RHS of (0 && foo()) is not evaluated.  We
can
   /// evaluate the expression regardless of what the RHS is, but C only
allows
   /// certain things in certain situations.
-  struct EvalInfo {
+  struct LLVM_ALIGNAS(/*alignof(uint64_t)*/ 8) EvalInfo {
     ASTContext &Ctx;

     /// EvalStatus - Contains information about the evaluation.

This has the downside that it will emit more stack realignment prologues
for MSVC x86 builds. I know Sony cares about MSVC-built clang performance,
but I don't know if they ship 32-bit or 64-bit binaries.

On Tue, Dec 13, 2016 at 11:43 AM, Reid Kleckner <rnk at google.com> wrote:

> It's probably this change:
>
> $ "C:/src/llvm/build_x86/./bin/clang.EXE" "-cc1" "-internal-isystem"
> "C:\src\llvm\build_x86\bin\..\lib\clang\4.0.0\include" "-nostdsysteminc"
> "-fsyntax-only" "-Wno-everything" "-Wobjc-literal-compare" "-Dnil=(id)0"
> "-verify" "C:\src\llvm\tools\clang\test\SemaObjC\objc-literal-
> comparison.m"
> # command stderr:
> Assertion failed: (PtrWord & ~PointerBitMask) == 0 && "Pointer is not
> sufficiently aligned", file C:\src\llvm\include\llvm/ADT/PointerIntPair.h,
> line 160
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161213/ff312adf/attachment.html>


More information about the cfe-commits mailing list