[PATCH] D97201: [flang] Detect circularly defined interfaces of procedures
Andrzej Warzynski via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 1 02:27:55 PST 2021
awarzynski added a comment.
In D97201#2593487 <https://reviews.llvm.org/D97201#2593487>, @kiranchandramohan wrote:
> @PeteSteinfeld
>
> The aarch64 flang buildbots are failing since this commit.
> https://lab.llvm.org/buildbot/#/builders/32/builds/3480
> The x86 buildbot is passing. https://lab.llvm.org/buildbot/#/builders/132
>
> From the failure it looks like a test expectation issue. Not sure, but it could be that the order/start/direction of the cycle could be different for aarch64, x86.
I believe that the problem stems from the switch from `std::set` to `std::unordered_set`. As a result, the order in which things are printed is implementation-defined (and will differ between platforms). However, that switch is also part of the fix here - I assume that reverting it is not desirable.
One other alternative would be to leverage FileCheck <https://llvm.org/docs/CommandGuide/FileCheck.html> and to use regex patterns in the tests. That would make the test less fragile, but I'm under the impression that people do prefer to use `test_errors.sh` instead (previous discussion here <https://lists.llvm.org/pipermail/flang-dev/2020-July/000407.html>). Just to demonstrate how a ported test would look, I've updated //resolve102.f90// and pasted it at the bottom of this message (passes on AArch64).
@PeteSteinfeld , thank you for working on this! As this is causing a breakage in 6 out of 8 of Flang's public buildbots, I will revert this for now (I'm not sure what the fix should be). Please let me know if I can help to re-land this change!
**PORTED TEST**
! RUN: not %f18 %s 2>&1 | FileCheck %s
! Tests for circularly defined procedures
! CHECK: Procedure 'sub' is recursively defined. Procedures in the cycle: '{{p2|sub}}', '{{p2|sub}}'
subroutine sub(p2)
PROCEDURE(sub) :: p2
call sub()
end subroutine
subroutine circular
! CHECK: Procedure 'p' is recursively defined. Procedures in the cycle: '{{p|p2|sub}}', '{{p|p2|sub}}', '{{p|p2|sub}}'
procedure(sub) :: p
call p(sub)
contains
subroutine sub(p2)
procedure(p) :: p2
end subroutine
end subroutine circular
program iface
! CHECK: Procedure 'p' is recursively defined. Procedures in the cycle: '{{p|p2|sub}}', '{{p|p2|sub}}', '{{p|p2|sub}}'
procedure(sub) :: p
interface
subroutine sub(p2)
import p
procedure(p) :: p2
end subroutine
end interface
call p(sub)
end program
Program mutual
Procedure(sub1) :: p
Call p(sub)
contains
! CHECK:: Procedure 'sub1' is recursively defined. Procedures in the cycle: '{{arg|p|sub1}}', '{{arg|p|sub1}}', '{{arg|p|sub1}}'
Subroutine sub1(arg)
procedure(sub1) :: arg
End Subroutine
Subroutine sub(p2)
Procedure(sub1) :: p2
End Subroutine
End Program
Program mutual1
Procedure(sub1) :: p
Call p(sub)
contains
! CHECK:: Procedure 'sub1' is recursively defined. Procedures in the cycle: '{{p2|sub|arg|p|sub1}}', '{{p2|sub|arg|p|sub1}}', '{{p2|sub|arg|p|sub1}}', '{{p2|sub|arg|p|sub1}}', '{{p2|sub|arg|p|sub1}}'
Subroutine sub1(arg)
procedure(sub) :: arg
End Subroutine
Subroutine sub(p2)
Procedure(sub1) :: p2
End Subroutine
End Program
program twoCycle
! CHECK:: The interface for procedure 'p1' is recursively defined
! CHECK:: The interface for procedure 'p2' is recursively defined
procedure(p1) p2
procedure(p2) p1
call p1
call p2
end program
program threeCycle
! CHECK:: The interface for procedure 'p1' is recursively defined
! CHECK:: The interface for procedure 'p2' is recursively defined
procedure(p1) p2
! CHECK:: The interface for procedure 'p3' is recursively defined
procedure(p2) p3
procedure(p3) p1
call p1
call p2
call p3
end program
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97201/new/
https://reviews.llvm.org/D97201
More information about the llvm-commits
mailing list