Open tblah opened 1 month ago
@llvm/issue-subscribers-flang-frontend
Author: Tom Eccles (tblah)
Interesting, so there are legitimate cases where the privatized symbol is at the same scope as the original one.
An easy fix here would be to replace DeclareNewPrivateAccessEntity
with DeclarePrivateAccessEntity
, in makePrivateSymbol
lambda, in flang/lib/Semantics/resolve-directives.cpp
, as well as removing const
from the symbol variables used in it.
Actually, replacing DeclareNewPrivateAccessEntity
with DeclarePrivateAccessEntity
didn't fix the issue, but an assert is hit in lowering instead:
Assertion failed: (hsb && "Host symbol box not found"), function doPrivatize, file DataSharingProcessor.cpp, line 455.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /Users/leandro.lupori/home/git/flang-luporl/buildr/bin/flang-new -fc1 -triple arm64-apple-macosx14.0.0 -emit-obj -fcolor-diagnostics -mrelocation-model pic -pic-level 2 -target-cpu apple-m1 -target-feature +zcm -target-feature +zcz -target-feature +v8.4a -target-feature +aes -target-feature +altnzcv -target-feature +ccdp -target-feature +complxnum -target-feature +crc -target-feature +dotprod -target-feature +fp-armv8 -target-feature +fp16fml -target-feature +fptoint -target-feature +fullfp16 -target-feature +jsconv -target-feature +lse -target-feature +neon -target-feature +pauth -target-feature +perfmon -target-feature +predres -target-feature +ras -target-feature +rcpc -target-feature +rdm -target-feature +sb -target-feature +sha2 -target-feature +sha3 -target-feature +specrestrict -target-feature +ssbs -fopenmp -resource-dir /Users/leandro.lupori/home/git/flang-luporl/buildr/lib/clang/20 -mframe-pointer=non-leaf -o ftest.o -x f95-cpp-input ftest.f90
#0 0x000000010073f994 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/Users/leandro.lupori/home/git/flang-luporl/buildr/bin/flang-new+0x1003e3994)
#1 0x000000010073da18 llvm::sys::RunSignalHandlers() (/Users/leandro.lupori/home/git/flang-luporl/buildr/bin/flang-new+0x1003e1a18)
#2 0x0000000100740050 SignalHandler(int) (/Users/leandro.lupori/home/git/flang-luporl/buildr/bin/flang-new+0x1003e4050)
#3 0x0000000185666584 (/usr/lib/system/libsystem_platform.dylib+0x18047a584)
#4 0x0000000185635c20 (/usr/lib/system/libsystem_pthread.dylib+0x180449c20)
#5 0x0000000185542a30 (/usr/lib/system/libsystem_c.dylib+0x180356a30)
#6 0x0000000185541d20 (/usr/lib/system/libsystem_c.dylib+0x180355d20)
#7 0x000000010539b12c Fortran::lower::omp::DataSharingProcessor::doPrivatize(Fortran::semantics::Symbol const*, mlir::omp::PrivateClauseOps*) (.cold.3) (/Users/leandro.lupori/home/git/flang-luporl/buildr/bin/flang-new+0x10503f12c)
#8 0x0000000101213ee8 Fortran::lower::omp::DataSharingProcessor::doPrivatize(Fortran::semantics::Symbol const*, mlir::omp::PrivateClauseOps*) (/Users/leandro.lupori/home/git/flang-luporl/buildr/bin/flang-new+0x100eb7ee8)
#9 0x00000001012104a8 Fortran::lower::omp::DataSharingProcessor::processStep1(mlir::omp::PrivateClauseOps*) (/Users/leandro.lupori/home/git/flang-luporl/buildr/bin/flang-new+0x100eb44a8)
#10 0x00000001012483fc genOMPDispatch(Fortran::lower::AbstractConverter&, Fortran::lower::SymMap&, Fortran::semantics::SemanticsContext&, Fortran::lower::pft::Evaluation&, mlir::Location, llvm::SmallVector<tomp::DirectiveWithClauses<Fortran::lower::omp::Clause>, 0u> const&, tomp::DirectiveWithClauses<Fortran::lower::omp::Clause> const*) (/Users/leandro.lupori/home/git/flang-luporl/buildr/bin/flang-new+0x100eec3fc)
[...]
This will require further investigation.
Minimal reproducer:
flang -fopenmp file.f90
The reproducer is simplified from these test cases: