[PATCH] D88597: [flang][openacc] Fix unparsing of combined construct (bug 47659)

Valentin Clement via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 30 10:44:33 PDT 2020


clementval updated this revision to Diff 295350.
clementval added a comment.

New line at the end of test file


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88597/new/

https://reviews.llvm.org/D88597

Files:
  flang/lib/Parser/unparse.cpp
  flang/test/Parser/acc-unparse.f90


Index: flang/test/Parser/acc-unparse.f90
===================================================================
--- /dev/null
+++ flang/test/Parser/acc-unparse.f90
@@ -0,0 +1,19 @@
+! RUN: %f18 -fopenacc -funparse %s | FileCheck %s
+
+! Test unparse does not crash with OpenACC directives.
+
+! Test bug 47659
+program bug47659
+  integer :: i, j
+  label1: do i = 1, 10
+    !$acc parallel loop
+    do j = 1, 10
+      if (j == 2) then
+        exit label1
+      end if
+    end do
+  end do label1
+end program
+
+!CHECK-LABEL: PROGRAM bug47659
+!CHECK: !$ACC PARALLEL LOOP
Index: flang/lib/Parser/unparse.cpp
===================================================================
--- flang/lib/Parser/unparse.cpp
+++ flang/lib/Parser/unparse.cpp
@@ -1903,8 +1903,8 @@
     EndOpenACC();
     Walk(std::get<std::optional<DoConstruct>>(x.t));
     BeginOpenACC();
-    Walk("!$ACC END ", std::get<std::optional<DoConstruct>>(x.t));
-    Put("\n");
+    Walk("!$ACC END ", std::get<std::optional<AccEndCombinedDirective>>(x.t),
+        "\n");
     EndOpenACC();
   }
   void Unparse(const OpenACCRoutineConstruct &x) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88597.295350.patch
Type: text/x-patch
Size: 1116 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200930/791392e5/attachment.bin>


More information about the llvm-commits mailing list