Flang crashes with an assertion failure when compiling !$omp atomic capture
with complex types in the swap pattern (v = x; x = expr). The crash occurs
in llvm::IntegerType::get() because getScalarSizeInBits() returns 0 for
struct types like {float, float}.
Reproducer (https://godbolt.org/z/s3q433E9e):
subroutine test_swap(x, v, expr)
complex(4) :: x, v, expr
!$omp atomic capture
v = x
x = expr
!$omp end atomic
end subroutine
flang -fopenmp -fopenmp-version=40 repro.f90 -c
Error message:
flang-23: warning: argument unused during compilation: '-c' [-Wunused-command-line-argument]
warning: OpenMP support for version 40 in flang is still incomplete
atomic memory access' size must be byte-sized
i0 %.atomic.load = load atomic i0, ptr %0 monotonic, align 1
IntToPtr result must be a pointer
%.atomic.ptrCast = inttoptr i0 %5 to { float, float }
atomic memory access' size must be byte-sized
i0 %7 = cmpxchg ptr %0, i0 %5, i0 %6 monotonic monotonic, align 9223372036854775808
error: failed to create the LLVM module
Compiler returned: 1
Flang crashes with an assertion failure when compiling
!$omp atomic capturewith complex types in the swap pattern (
v = x; x = expr). The crash occursin
llvm::IntegerType::get()becausegetScalarSizeInBits()returns 0 forstruct types like
{float, float}.Reproducer (https://godbolt.org/z/s3q433E9e):
Error message: