r289575 - Align EvalInfo in ExprConstant to avoid PointerUnion assertions

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

Author: rnk
Date: Tue Dec 13 13:48:32 2016
New Revision: 289575

URL: http://llvm.org/viewvc/llvm-project?rev=289575&view=rev
Align EvalInfo in ExprConstant to avoid PointerUnion assertions

32-bit MSVC doesn't provide more than 4 byte stack alignment by default.
This conflicts with PointerUnion's attempt to make assertions about
alignment. This fixes the problem by explicitly asking the compiler for
8 byte alignment.


Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=289575&r1=289574&r2=289575&view=diff
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Tue Dec 13 13:48:32 2016
@@ -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.

More information about the cfe-commits mailing list