Skip to content

Commit d471d6f

Browse files
authored
Merge pull request #1035 from schweitzpgi/ch-n4e.n1
Fix bug with adjusted array element value types.
2 parents 4005808 + ada9831 commit d471d6f

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

flang/lib/Lower/ConvertExpr.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2451,12 +2451,13 @@ class ScalarArrayExprLowering {
24512451
ExtValue result;
24522452
if (semant == ConstituentSemantics::ProjectedCopyInCopyOut) {
24532453
auto innerArg = expSpace.findArgumentOfLoad(load);
2454-
auto resTy = adjustedArrayElementType(innerArg.getType());
24552454
auto path = lowerPath(load.getType());
2456-
auto eleTy = fir::applyPathToType(resTy, path);
2457-
auto castedElement = builder.createConvert(loc, eleTy, elementalValue);
2458-
auto update = builder.create<fir::ArrayUpdateOp>(
2459-
loc, resTy, innerArg, castedElement, path, load.typeparams());
2455+
auto eleTy = fir::applyPathToType(innerArg.getType(), path);
2456+
auto toTy = adjustedArrayElementType(eleTy);
2457+
auto castedElement = builder.createConvert(loc, toTy, elementalValue);
2458+
auto update = builder.create<fir::ArrayUpdateOp>(loc, innerArg.getType(),
2459+
innerArg, castedElement,
2460+
path, load.typeparams());
24602461
// Flag the offsets as "Fortran" as they are not zero-origin.
24612462
update->setAttr(fir::factory::attrFortranArrayOffsets(),
24622463
builder.getUnitAttr());

flang/lib/Optimizer/Builder/FIRBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
#include "flang/Optimizer/Builder/Character.h"
1313
#include "flang/Optimizer/Builder/Complex.h"
1414
#include "flang/Optimizer/Builder/MutableBox.h"
15+
#include "flang/Optimizer/Builder/Runtime/Assign.h"
1516
#include "flang/Optimizer/Dialect/FIRAttr.h"
1617
#include "flang/Optimizer/Dialect/FIROpsSupport.h"
17-
#include "flang/Optimizer/Builder/Runtime/Assign.h"
1818
#include "flang/Optimizer/Support/FatalError.h"
1919
#include "flang/Optimizer/Support/InternalNames.h"
2020
#include "mlir/Dialect/OpenMP/OpenMPDialect.h"

0 commit comments

Comments
 (0)