Skip to content

[Flang][OpenMP] Assertion `success && "Privatization failed due to existing binding"' failed. (parallel sections directive) #135108

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

Closed
k-arrows opened this issue Apr 10, 2025 · 2 comments · Fixed by #138159
Assignees
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] flang:ir flang:openmp

Comments

@k-arrows
Copy link

Reproducer:

!$omp parallel sections
!$omp section
    do i = 1, 2
    end do
!$omp section
    do i = 1, 2
    end do
!$omp end parallel sections
end

With assertion-disabled flang, the following output is obtained:
https://godbolt.org/z/GbfW7vYKj

flang-21: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
error: loc("/app/example.f90":6:5): operand #1 does not dominate this use
error: verification of lowering to FIR failed
Compiler returned: 1

With assertion-enabled flang, the reproducer hits the following assertion:

flang: /path_to_project/llvm-project/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp:152: void Fortran::lower::omp::DataSharingProcessor::cloneSymbol(const semantics::Symbol *): Assertion `success && "Privatization failed due to existing binding"' failed.
@llvmbot llvmbot added the flang Flang issues not falling into any other category label Apr 10, 2025
@k-arrows k-arrows changed the title [Flang][OpenMP] Assertion `success && "Privatization failed due to existing binding"' failed. [Flang][OpenMP] Assertion `success && "Privatization failed due to existing binding"' failed. (parallel sections directive) Apr 10, 2025
@k-arrows k-arrows added flang:openmp and removed flang Flang issues not falling into any other category labels Apr 10, 2025
@k-arrows
Copy link
Author

The fact that the same loop variable is used in both the first and second loop in the reproducer may be essential. In fact, the following program compiles without any problems.

!$omp parallel sections
!$omp section
    do i = 1, 2
    end do
!$omp section
    do j = 1, 2
    end do
!$omp end parallel sections
end

@EugeneZelenko EugeneZelenko added flang:ir crash Prefer [crash-on-valid] or [crash-on-invalid] labels Apr 10, 2025
@llvmbot
Copy link
Member

llvmbot commented Apr 10, 2025

@llvm/issue-subscribers-flang-ir

Author: None (k-arrows)

Reproducer: ```f90 !$omp parallel sections !$omp section do i = 1, 2 end do !$omp section do i = 1, 2 end do !$omp end parallel sections end ```

With assertion-disabled flang, the following output is obtained:
https://godbolt.org/z/GbfW7vYKj

flang-21: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
error: loc("/app/example.f90":6:5): operand #<!-- -->1 does not dominate this use
error: verification of lowering to FIR failed
Compiler returned: 1

With assertion-enabled flang, the reproducer hits the following assertion:

flang: /path_to_project/llvm-project/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp:152: void Fortran::lower::omp::DataSharingProcessor::cloneSymbol(const semantics::Symbol *): Assertion `success &amp;&amp; "Privatization failed due to existing binding"' failed.

@tblah tblah self-assigned this Apr 30, 2025
tblah added a commit to tblah/llvm-project that referenced this issue May 1, 2025
This now produces code equivalent to if there was an explicit private
clause on the SECTIONS construct.

The problem was that each SECTION construct got its own DSP, which tried
to privatize the same symbol for that SECTION. Privatization for
SECTION(S) happens on the outer SECTION construct and so the outer
construct's DSP should be shared.

Fixes llvm#135108
tblah added a commit that referenced this issue May 8, 2025
This now produces code equivalent to if there was an explicit private
clause on the SECTIONS construct.

The problem was that each SECTION construct got its own DSP, which tried
to privatize the same symbol for that SECTION. Privatization for
SECTION(S) happens on the outer SECTION construct and so the outer
construct's DSP should be shared.

Fixes #135108
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] flang:ir flang:openmp
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants