Skip to content

Commit 1db23e1

Browse files
committed
Fix bug with inner implicit context not finalizing the context in the
right position. k6
1 parent a9e2159 commit 1db23e1

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

flang/lib/Lower/ConvertExpr.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3234,12 +3234,14 @@ class ArrayExprLowering {
32343234
determineShapeOfDest(lhs);
32353235
semant = ConstituentSemantics::RefTransparent;
32363236
auto exv = lowerArrayExpression(rhs);
3237-
if (explicitSpaceIsActive())
3237+
if (explicitSpaceIsActive()) {
3238+
explicitSpace->finalizeContext();
32383239
builder.create<fir::ResultOp>(loc, fir::getBase(exv));
3239-
else
3240+
} else {
32403241
builder.create<fir::ArrayMergeStoreOp>(
32413242
loc, destination, fir::getBase(exv), destination.memref(),
32423243
destination.slice(), destination.typeparams());
3244+
}
32433245
}
32443246

32453247
//===--------------------------------------------------------------------===//
@@ -3344,12 +3346,14 @@ class ArrayExprLowering {
33443346
// Finish lowering the loop nest.
33453347
assert(destination && "destination must have been set");
33463348
auto exv = lowerArrayExpression(rhsCC, resultTy);
3347-
if (explicitSpaceIsActive())
3349+
if (explicitSpaceIsActive()) {
3350+
explicitSpace->finalizeContext();
33483351
builder.create<fir::ResultOp>(loc, fir::getBase(exv));
3349-
else
3352+
} else {
33503353
builder.create<fir::ArrayMergeStoreOp>(
33513354
loc, destination, fir::getBase(exv), destination.memref(),
33523355
destination.slice(), destination.typeparams());
3356+
}
33533357
}
33543358

33553359
/// Entry point for when an array expression appears on the lhs of an
@@ -3729,12 +3733,14 @@ class ArrayExprLowering {
37293733
determineShapeOfDest(lhs);
37303734
semant = ConstituentSemantics::RefTransparent;
37313735
auto exv = lowerArrayExpression(rhs);
3732-
if (explicitSpaceIsActive())
3736+
if (explicitSpaceIsActive()) {
3737+
explicitSpace->finalizeContext();
37333738
builder.create<fir::ResultOp>(loc, fir::getBase(exv));
3734-
else
3739+
} else {
37353740
builder.create<fir::ArrayMergeStoreOp>(
37363741
loc, destination, fir::getBase(exv), destination.memref(),
37373742
destination.slice(), destination.typeparams());
3743+
}
37383744
}
37393745

37403746
/// Compute the shape of a slice.

0 commit comments

Comments
 (0)