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][openmp] Crash on simd reduction #111567

Closed
psteinfeld opened this issue Oct 8, 2024 · 4 comments
Closed

[flang][openmp] Crash on simd reduction #111567

psteinfeld opened this issue Oct 8, 2024 · 4 comments
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] flang:ir flang:openmp

Comments

@psteinfeld
Copy link
Contributor

Here's a test:

$cat bug.f90
real function fastsum(x,y,n) result(r)
  integer,intent(in) :: n
  real,intent(in) :: x(n),y(n)
  integer i
  !$omp simd reduction(+:r)
    do i=1,n
      r = r + (x(i) + y(i))
    end do
  !$omp end simd
end function
$flang-new -fopenmp bug.f90
flang-new: /local/home/psteinfeld/up/llvm-project/llvm/include/llvm/ADT/STLExtra
s.h:865: llvm::detail::zippy<llvm::detail::zip_first, T, U, Args ...> llvm::zip_
equal(T&&, U&&, Args&& ...) [with T = llvm::SmallVector<const Fortran::semantics
::Symbol*>&; U = llvm::ArrayRef<mlir::Value>&; Args = {llvm::ArrayRef<mlir::Bloc
kArgument>&}]: Assertion `all_equal({range_size(t), range_size(u), range_size(ar
gs)...}) && "Iteratees do not have equal length"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and i
nclude the crash backtrace.
Stack dump:
0. Program arguments: /local/home/psteinfeld/up/install/bin/flang-new -fc1 
-triple x86_64-unknown-linux-gnu -emit-obj -mrelocation-model pic -pic-level 2 -
pic-is-pie -target-cpu x86-64 -fopenmp -resource-dir /local/home/psteinfeld/up/i
nstall/lib/clang/20 -mframe-pointer=all -o /tmp/bug-939914.o -x f95-cpp-input bu
g.f90
 #0 0x0000562b587ccf4b llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/loc
al/home/psteinfeld/up/install/bin/flang-new+0x2251f4b)
 #1 0x0000562b587ca754 SignalHandler(int) Signals.cpp:0:0
 #2 0x00007fd4dc08b420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x144
20)
 #3 0x00007fd4dbd1f00b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
 #4 0x00007fd4dbcfe859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #5 0x00007fd4dbcfe729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
 #6 0x00007fd4dbd0ffd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #7 0x0000562b590bb6cf bindEntryBlockArgs(Fortran::lower::AbstractConverter&, ml
ir::omp::BlockArgOpenMPOpInterface, (anonymous namespace)::EntryBlockArgs const&
)::'lambda1'(llvm::ArrayRef<Fortran::semantics::Symbol const*>, llvm::ArrayRef<m
lir::Value>, llvm::ArrayRef<mlir::BlockArgument>)::operator()(llvm::ArrayRef<For
tran::semantics::Symbol const*>, llvm::ArrayRef<mlir::Value>, llvm::ArrayRef<mli
r::BlockArgument>) const (.isra.0) OpenMP.cpp:0:0
 #8 0x0000562b590bba7c bindEntryBlockArgs(Fortran::lower::AbstractConverter&, ml
ir::omp::BlockArgOpenMPOpInterface, (anonymous namespace)::EntryBlockArgs const&
) OpenMP.cpp:0:0
 #9 0x0000562b590bc271 genLoopVars(mlir::Operation*, Fortran::lower::AbstractCon
verter&, mlir::Location&, llvm::ArrayRef<Fortran::semantics::Symbol const*>, llv
m::ArrayRef<std::pair<mlir::omp::BlockArgOpenMPOpInterface, (anonymous namespace
)::EntryBlockArgs const&>>) (.isra.0) OpenMP.cpp:0:0
...

This code previously compiled without emitting any messages. It looks like the problem started happening with update #110267.

@github-actions github-actions bot added the flang Flang issues not falling into any other category label Oct 8, 2024
@EugeneZelenko EugeneZelenko added flang:ir crash Prefer [crash-on-valid] or [crash-on-invalid] flang:openmp and removed flang Flang issues not falling into any other category labels Oct 8, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Oct 8, 2024

@llvm/issue-subscribers-flang-ir

Author: Pete Steinfeld (psteinfeld)

Here's a test: ``` $cat bug.f90 real function fastsum(x,y,n) result(r) integer,intent(in) :: n real,intent(in) :: x(n),y(n) integer i !$omp simd reduction(+:r) do i=1,n r = r + (x(i) + y(i)) end do !$omp end simd end function $flang-new -fopenmp bug.f90 flang-new: /local/home/psteinfeld/up/llvm-project/llvm/include/llvm/ADT/STLExtra s.h:865: llvm::detail::zippy<llvm::detail::zip_first, T, U, Args ...> llvm::zip_ equal(T&&, U&&, Args&& ...) [with T = llvm::SmallVector<const Fortran::semantics ::Symbol*>&; U = llvm::ArrayRef<mlir::Value>&; Args = {llvm::ArrayRef<mlir::Bloc kArgument>&}]: Assertion `all_equal({range_size(t), range_size(u), range_size(ar gs)...}) && "Iteratees do not have equal length"' failed. PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and i nclude the crash backtrace. Stack dump: 0. Program arguments: /local/home/psteinfeld/up/install/bin/flang-new -fc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelocation-model pic -pic-level 2 - pic-is-pie -target-cpu x86-64 -fopenmp -resource-dir /local/home/psteinfeld/up/i nstall/lib/clang/20 -mframe-pointer=all -o /tmp/bug-939914.o -x f95-cpp-input bu g.f90 #0 0x0000562b587ccf4b llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/loc al/home/psteinfeld/up/install/bin/flang-new+0x2251f4b) #1 0x0000562b587ca754 SignalHandler(int) Signals.cpp:0:0 #2 0x00007fd4dc08b420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x144 20) #3 0x00007fd4dbd1f00b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b) #4 0x00007fd4dbcfe859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859) #5 0x00007fd4dbcfe729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729) #6 0x00007fd4dbd0ffd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6) #7 0x0000562b590bb6cf bindEntryBlockArgs(Fortran::lower::AbstractConverter&, ml ir::omp::BlockArgOpenMPOpInterface, (anonymous namespace)::EntryBlockArgs const& )::'lambda1'(llvm::ArrayRef<Fortran::semantics::Symbol const*>, llvm::ArrayRef<m lir::Value>, llvm::ArrayRef<mlir::BlockArgument>)::operator()(llvm::ArrayRef<For tran::semantics::Symbol const*>, llvm::ArrayRef<mlir::Value>, llvm::ArrayRef<mli r::BlockArgument>) const (.isra.0) OpenMP.cpp:0:0 #8 0x0000562b590bba7c bindEntryBlockArgs(Fortran::lower::AbstractConverter&, ml ir::omp::BlockArgOpenMPOpInterface, (anonymous namespace)::EntryBlockArgs const& ) OpenMP.cpp:0:0 #9 0x0000562b590bc271 genLoopVars(mlir::Operation*, Fortran::lower::AbstractCon verter&, mlir::Location&, llvm::ArrayRef<Fortran::semantics::Symbol const*>, llv m::ArrayRef<std::pair<mlir::omp::BlockArgOpenMPOpInterface, (anonymous namespace )::EntryBlockArgs const&>>) (.isra.0) OpenMP.cpp:0:0 ... ``` This code previously compiled without emitting any messages. It looks like the problem started happening with update #110267.

@skatrak
Copy link
Contributor

skatrak commented Oct 9, 2024

This should address it: #111523.

@skatrak
Copy link
Contributor

skatrak commented Oct 11, 2024

Can someone check if the issue is resolved?

@tblah
Copy link
Contributor

tblah commented Oct 11, 2024

It is resolved for me

@tblah tblah closed this as completed Oct 11, 2024
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

No branches or pull requests

5 participants