Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[flang] compilation hangs in CheckScopeConstraints #64654

Closed
k-arrows opened this issue Aug 13, 2023 · 5 comments
Closed

[flang] compilation hangs in CheckScopeConstraints #64654

k-arrows opened this issue Aug 13, 2023 · 5 comments
Assignees
Labels
bug Indicates an unexpected problem or unintended behavior flang:frontend

Comments

@k-arrows
Copy link

The following test program causes a hang, and it is documented in llvm-test-suite. (See https://github.com/llvm/llvm-test-suite/blob/5942ca45a1036ace15b70e117d636ecf89224957/Fortran/gfortran/regression/DisabledFiles.cmake#L1974)
https://github.com/llvm/llvm-test-suite/blob/main/Fortran/gfortran/regression/goto_5.f90

I will write here what I confirmed about this hang using the perf command.

perf record & perf report:

$ timeout 10 perf record -g flang-new -c goto_5.f90
[ perf record: Woken up 10 times to write data ]
[ perf record: Captured and wrote 2.393 MB perf.data (39133 samples) ]
$ perf report | c++filt

Here is the output of the perf report command:

    99.88%    99.88%  flang-new  flang-new             [.] Fortran::semantics::CheckScopeConstraints(std::vector<Fortran::semantics::SourceStatementInfoTuplePOD, std::allocator<Fortran::semantics::SourceStatementInfoTuplePOD> > const&, std::map<unsigned long, Fortran::semantics::LabeledStatementInfoTuplePOD, std::less<unsigned long>, std::allocator<std::pair<unsigned long const, Fortran::semantics::LabeledStatementInfoTuplePOD> > > const&, std::vector<Fortran::semantics::ScopeInfo, std::allocator<Fortran::semantics::ScopeInfo> > const&, Fortran::semantics::SemanticsContext&)
            |
            ---Fortran::semantics::CheckScopeConstraints(std::vector<Fortran::semantics::SourceStatementInfoTuplePOD, std::allocator<Fortran::semantics::SourceStatementInfoTuplePOD> > const&, std::map<unsigned long, Fortran::semantics::LabeledStatementInfoTuplePOD, std::less<unsigned long>, std::allocator<std::pair<unsigned long const, Fortran::semantics::LabeledStatementInfoTuplePOD> > > const&, std::vector<Fortran::semantics::ScopeInfo, std::allocator<Fortran::semantics::ScopeInfo> > const&, Fortran::semantics::SemanticsContext&)

From this output, we can see that almost all the time of compilation is spent with the symbol Fortran::semantics::CheckScopeConstraints. This symbol seems to come from a function called CheckScopeConstraints in the namespace Fortran::semantics.

void CheckScopeConstraints(const SourceStmtList &stmts,

@llvmbot
Copy link
Collaborator

llvmbot commented Aug 13, 2023

@llvm/issue-subscribers-flang-frontend

@psteinfeld psteinfeld added the bug Indicates an unexpected problem or unintended behavior label Aug 14, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented Aug 14, 2023

@llvm/issue-subscribers-bug

@klausler klausler self-assigned this Aug 18, 2023
@klausler
Copy link
Contributor

Fix is coming shortly.

@klausler
Copy link
Contributor

https://reviews.llvm.org/D159040

@klausler
Copy link
Contributor

Fix has been merged into llvm-project/main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior flang:frontend
Projects
None yet
Development

No branches or pull requests

5 participants