[PATCH] D34873: Fix miscompiled 32bit binaries by mingw
Ivan Donchevskii via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 30 04:30:37 PDT 2017
yvvan created this revision.
With that patch applied my 32-bit libclang.dll built with mingw does not crash anymore
unit tests are not affected by that change
https://reviews.llvm.org/D34873
Files:
lib/AST/ExprConstant.cpp
Index: lib/AST/ExprConstant.cpp
===================================================================
--- lib/AST/ExprConstant.cpp
+++ lib/AST/ExprConstant.cpp
@@ -433,7 +433,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.
@@ -471,7 +471,7 @@
/// The current array initialization index, if we're performing array
/// initialization.
- uint64_t ArrayInitIndex = -1;
+ uint32_t ArrayInitIndex = -1;
/// HasActiveDiagnostic - Was the previous diagnostic stored? If so, further
/// notes attached to it will also be stored, otherwise they will not be.
@@ -810,7 +810,7 @@
class ArrayInitLoopIndex {
EvalInfo &Info;
- uint64_t OuterIndex;
+ uint32_t OuterIndex;
public:
ArrayInitLoopIndex(EvalInfo &Info)
@@ -819,7 +819,7 @@
}
~ArrayInitLoopIndex() { Info.ArrayInitIndex = OuterIndex; }
- operator uint64_t&() { return Info.ArrayInitIndex; }
+ operator uint32_t&() { return Info.ArrayInitIndex; }
};
};
@@ -6299,7 +6299,7 @@
auto *CAT = cast<ConstantArrayType>(E->getType()->castAsArrayTypeUnsafe());
- uint64_t Elements = CAT->getSize().getZExtValue();
+ uint32_t Elements = CAT->getSize().getZExtValue();
Result = APValue(APValue::UninitArray(), Elements, Elements);
LValue Subobject = This;
@@ -6477,7 +6477,7 @@
}
bool VisitArrayInitIndexExpr(const ArrayInitIndexExpr *E) {
- if (Info.ArrayInitIndex == uint64_t(-1)) {
+ if (Info.ArrayInitIndex == uint32_t(-1)) {
// We were asked to evaluate this subexpression independent of the
// enclosing ArrayInitLoopExpr. We can't do that.
Info.FFDiag(E);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34873.104841.patch
Type: text/x-patch
Size: 1979 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170630/88ee46cf/attachment.bin>
More information about the cfe-commits
mailing list