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

This patch fixes the bug report in https://bugs.llvm.org/show_bug.cgi?id=47659

Reviewed By: sameeranjoshi

Differential Revision: https://reviews.llvm.org/D88597
This commit is contained in:
Valentin Clement 2020-10-01 10:34:50 -04:00 committed by clementval
parent e20f459229
commit 91b49fc257
2 changed files with 21 additions and 2 deletions

View File

@ -1903,8 +1903,8 @@ public:
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) {

View File

@ -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