[flang] Add correct number of args for wait
authorValentin Clement <clementval@gmail.com>
Fri, 1 Jul 2022 08:16:09 +0000 (10:16 +0200)
committerValentin Clement <clementval@gmail.com>
Fri, 1 Jul 2022 08:16:36 +0000 (10:16 +0200)
Add source coordinates to BeginWait and BeginWaitAll calls

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D128970

Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
flang/lib/Lower/IO.cpp
flang/test/Lower/io-statement-1.f90

index fdf001d..6545d20 100644 (file)
@@ -1764,6 +1764,11 @@ Fortran::lower::genWaitStatement(Fortran::lower::AbstractConverter &converter,
     mlir::Value id = fir::getBase(converter.genExprValue(
         loc, getExpr<Fortran::parser::IdExpr>(stmt), stmtCtx));
     args.push_back(builder.createConvert(loc, beginFuncTy.getInput(1), id));
+    args.push_back(locToFilename(converter, loc, beginFuncTy.getInput(2)));
+    args.push_back(locToLineNo(converter, loc, beginFuncTy.getInput(3)));
+  } else {
+    args.push_back(locToFilename(converter, loc, beginFuncTy.getInput(1)));
+    args.push_back(locToLineNo(converter, loc, beginFuncTy.getInput(2)));
   }
   auto cookie = builder.create<fir::CallOp>(loc, beginFunc, args).getResult(0);
   genConditionHandlerCall(converter, loc, cookie, stmt.v, csi);
index e380d32..e30d184 100644 (file)
@@ -28,7 +28,7 @@
   ! CHECK: call {{.*}}EndIoStatement
   endfile(8)
 
-  ! CHECK: call {{.*}}BeginWaitAll
+  ! CHECK: call {{.*}}BeginWaitAll(%{{.*}}, %{{.*}}, %{{.*}})
   ! CHECK: call {{.*}}EndIoStatement
   wait(unit=8)