Index: lib/AST/ExprConstant.cpp =================================================================== --- lib/AST/ExprConstant.cpp +++ lib/AST/ExprConstant.cpp @@ -537,7 +537,7 @@ /// 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 LLVM_ALIGNAS(/*alignof(uint64_t)*/ 8) EvalInfo { + struct EvalInfo { ASTContext &Ctx; /// EvalStatus - Contains information about the evaluation. @@ -575,7 +575,13 @@ /// The current array initialization index, if we're performing array /// initialization. - uint64_t ArrayInitIndex = -1; + /// uint64_t value is split into two uint32_t values as a workaround + /// to deal with mingw 32-bit miscompilation + uint32_t ArrayInitIndex[2] = {static_cast(-1), static_cast(-1)}; + + uint64_t& GetArrayInitIndex() { + return reinterpret_cast(ArrayInitIndex[0]); + } /// HasActiveDiagnostic - Was the previous diagnostic stored? If so, further /// notes attached to it will also be stored, otherwise they will not be. @@ -923,12 +929,12 @@ public: ArrayInitLoopIndex(EvalInfo &Info) - : Info(Info), OuterIndex(Info.ArrayInitIndex) { - Info.ArrayInitIndex = 0; + : Info(Info), OuterIndex{Info.GetArrayInitIndex()} { + Info.GetArrayInitIndex() = 0; } - ~ArrayInitLoopIndex() { Info.ArrayInitIndex = OuterIndex; } + ~ArrayInitLoopIndex() { Info.GetArrayInitIndex() = OuterIndex; } - operator uint64_t&() { return Info.ArrayInitIndex; } + operator uint64_t&() { return Info.GetArrayInitIndex(); } }; }; @@ -6973,13 +6979,13 @@ } bool VisitArrayInitIndexExpr(const ArrayInitIndexExpr *E) { - if (Info.ArrayInitIndex == uint64_t(-1)) { + if (Info.GetArrayInitIndex() == uint64_t(-1)) { // We were asked to evaluate this subexpression independent of the // enclosing ArrayInitLoopExpr. We can't do that. Info.FFDiag(E); return false; } - return Success(Info.ArrayInitIndex, E); + return Success(Info.GetArrayInitIndex(), E); } // Note, GNU defines __null as an integer, not a pointer.