Skip to content

Commit 8bcb40c

Browse files
committed
Fix bug with arguments passed in reverse. ch6egs1, 615t621, e12
1 parent 23dafdb commit 8bcb40c

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

flang/include/flang/Optimizer/Dialect/FIROps.td

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,6 +1343,16 @@ def fir_ArrayLoadOp : fir_Op<"array_load", [AttrSizedOperandSegments]> {
13431343
let summary = "Load an array as a value.";
13441344

13451345
let description = [{
1346+
This operation taken with array_merge_store captures Fortran's
1347+
copy-in/copy-out semantics. One way to think of this is that array_load
1348+
creates a snapshot copy of the entire array. This copy can then be used
1349+
as the "original value" of the array while the array's new value is
1350+
computed. The array_merge_store operation is the copy-out semantics, which
1351+
merge the updates with the original array value to produce the final array
1352+
result. This abstracts the copy operations as opposed to always creating
1353+
copies or requiring dependence analysis be performed on the syntax trees
1354+
and before lowering to the IR.
1355+
13461356
Load an entire array as a single SSA value.
13471357

13481358
```fortran

flang/lib/Lower/ConvertExpr.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2520,9 +2520,9 @@ createCharArrayAmend(mlir::Location loc, fir::FirOpBuilder &builder,
25202520
fir::factory::CharacterExprHelper helper{builder, loc};
25212521
if (!bounds.empty()) {
25222522
dstChar = helper.createSubstring(dstChar, bounds);
2523-
fir::factory::genCharacterCopy(dstChar.getAddr(), dstChar.getLen(),
2524-
fir::getBase(srcExv), fir::getLen(srcExv),
2525-
builder, loc);
2523+
fir::factory::genCharacterCopy(fir::getBase(srcExv), fir::getLen(srcExv),
2524+
dstChar.getAddr(), dstChar.getLen(), builder,
2525+
loc);
25262526
// Update the LEN to the substring's LEN.
25272527
dstLen = dstChar.getLen();
25282528
}

0 commit comments

Comments
 (0)