Fix bug in mask selection for references.
We should always use the full mask when storing to a reference, since we don't in general know what it refers to (and thence the appropriate mask to use for its target).
This commit is contained in:
10
expr.cpp
10
expr.cpp
@@ -638,10 +638,12 @@ lLLVMConstantValue(const Type *type, llvm::LLVMContext *ctx, double value) {
|
||||
|
||||
static llvm::Value *
|
||||
lMaskForSymbol(Symbol *baseSym, FunctionEmitContext *ctx) {
|
||||
if (dynamic_cast<const PointerType *>(baseSym->type) != NULL)
|
||||
// FIXME: we really only want to do this for dereferencing the
|
||||
// pointer, not for things like pointer arithmetic, when we may be
|
||||
// able to use the internal mask, depending on context...
|
||||
if (dynamic_cast<const PointerType *>(baseSym->type) != NULL ||
|
||||
dynamic_cast<const ReferenceType *>(baseSym->type) != NULL)
|
||||
// FIXME: for pointers, we really only want to do this for
|
||||
// dereferencing the pointer, not for things like pointer
|
||||
// arithmetic, when we may be able to use the internal mask,
|
||||
// depending on context...
|
||||
return ctx->GetFullMask();
|
||||
|
||||
llvm::Value *mask = (baseSym->parentFunction == ctx->GetFunction() &&
|
||||
|
||||
Reference in New Issue
Block a user