-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[Flang][OpenMP] Assertion `!lenParams.empty()' failed. #108136
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
Labels
Comments
@llvm/issue-subscribers-flang-ir Author: None (k-arrows)
Crash itself is reproducible on Godbolt:
https://godbolt.org/z/5j5cYMf3f
Reproducer: character(:), pointer :: c
character(2), pointer :: c2
!$omp threadprivate(c, c2)
end Stack dump: # flang-new -fopenmp test.f90
flang-new: /opt/llvm-project/flang/lib/Optimizer/CodeGen/CodeGen.cpp:1113: mlir::Value EmboxCommonConversion<fir::EmboxOp>::getCharacterByteSize(mlir::Location, mlir::ConversionPatternRewriter &, fir::CharacterType, mlir::ValueRange) const [OP = fir::EmboxOp]: Assertion `!lenParams.empty()' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /opt/llvm/bin/flang-new -fc1 -triple aarch64-unknown-linux-gnu -emit-obj -fcolor-diagnostics -mrelocation-model pic -pic-level 2 -pic-is-pie -target-cpu generic -target-feature +outline-atomics -target-feature +v8a -target-feature +fp-armv8 -target-feature +neon -fopenmp -resource-dir /opt/llvm/lib/clang/20 -mframe-pointer=non-leaf -o /tmp/test-83cdbb.o -x f95-cpp-input test.f90
#<!-- -->0 0x0000ffffa8419948 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/llvm/lib/libLLVMSupport.so.20.0git+0x189948)
#<!-- -->1 0x0000ffffa84177f0 llvm::sys::RunSignalHandlers() (/opt/llvm/lib/libLLVMSupport.so.20.0git+0x1877f0)
#<!-- -->2 0x0000ffffa841a064 SignalHandler(int) Signals.cpp:0:0
#<!-- -->3 0x0000ffffa9e4b770 (linux-vdso.so.1+0x770)
#<!-- -->4 0x0000ffffa7de7628 (/usr/lib/aarch64-linux-gnu/libc.so.6+0x87628)
#<!-- -->5 0x0000ffffa7d9cb3c raise (/usr/lib/aarch64-linux-gnu/libc.so.6+0x3cb3c)
#<!-- -->6 0x0000ffffa7d87e00 abort (/usr/lib/aarch64-linux-gnu/libc.so.6+0x27e00)
#<!-- -->7 0x0000ffffa7d95cbc (/usr/lib/aarch64-linux-gnu/libc.so.6+0x35cbc)
#<!-- -->8 0x0000ffffa7d95d2c (/usr/lib/aarch64-linux-gnu/libc.so.6+0x35d2c)
#<!-- -->9 0x0000ffffa2be3b28 EmboxCommonConversion<fir::EmboxOp>::getCharacterByteSize(mlir::Location, mlir::ConversionPatternRewriter&, fir::CharacterType, mlir::ValueRange) const (/opt/llvm/lib/libFIRCodeGen.so.20.0git+0x73b28)
#<!-- -->10 0x0000ffffa2be2da8 EmboxCommonConversion<fir::EmboxOp>::getSizeAndTypeCode(mlir::Location, mlir::ConversionPatternRewriter&, mlir::Type, mlir::ValueRange) const (/opt/llvm/lib/libFIRCodeGen.so.20.0git+0x72da8)
#<!-- -->11 0x0000ffffa2be2844 std::tuple<fir::BaseBoxType, mlir::Value, mlir::Value> EmboxCommonConversion<fir::EmboxOp>::consDescriptorPrefix<fir::EmboxOp>(fir::EmboxOp, mlir::Type, mlir::ConversionPatternRewriter&, unsigned int, mlir::ValueRange, mlir::ValueRange, mlir::Value, mlir::Type) const (/opt/llvm/lib/libFIRCodeGen.so.20.0git+0x72844)
#<!-- -->12 0x0000ffffa2be2364 EmboxOpConversion::matchAndRewrite(fir::EmboxOp, fir::EmboxOpAdaptor, mlir::ConversionPatternRewriter&) const (/opt/llvm/lib/libFIRCodeGen.so.20.0git+0x72364)
#<!-- -->13 0x0000ffffa2be2050 fir::FIROpConversion<fir::EmboxOp>::matchAndRewrite(mlir::Operation*, llvm::ArrayRef<mlir::Value>, mlir::ConversionPatternRewriter&) const (/opt/llvm/lib/libFIRCodeGen.so.20.0git+0x72050)
#<!-- -->14 0x0000ffff9c14afcc mlir::ConversionPattern::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&) const (/opt/llvm/lib/libMLIRTransformUtils.so.20.0git+0x2afcc)
#<!-- -->15 0x0000ffff9c0bb8b8 void llvm::function_ref<void ()>::callback_fn<mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&, llvm::function_ref<bool (mlir::Pattern const&)>, llvm::function_ref<void (mlir::Pattern const&)>, llvm::function_ref<llvm::LogicalResult (mlir::Pattern const&)>)::$_0>(long) PatternApplicator.cpp:0:0
#<!-- -->16 0x0000ffff9c0b819c mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&, llvm::function_ref<bool (mlir::Pattern const&)>, llvm::function_ref<void (mlir::Pattern const&)>, llvm::function_ref<llvm::LogicalResult (mlir::Pattern const&)>) (/opt/llvm/lib/libMLIRRewrite.so.20.0git+0x819c)
#<!-- -->17 0x0000ffff9c14c01c (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*, mlir::ConversionPatternRewriter&) DialectConversion.cpp:0:0
#<!-- -->18 0x0000ffff9c14b074 mlir::OperationConverter::convert(mlir::ConversionPatternRewriter&, mlir::Operation*) (/opt/llvm/lib/libMLIRTransformUtils.so.20.0git+0x2b074)
#<!-- -->19 0x0000ffff9c14c22c mlir::OperationConverter::convertOperations(llvm::ArrayRef<mlir::Operation*>) (/opt/llvm/lib/libMLIRTransformUtils.so.20.0git+0x2c22c)
#<!-- -->20 0x0000ffff9c153e24 mlir::applyFullConversion(mlir::Operation*, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig) (/opt/llvm/lib/libMLIRTransformUtils.so.20.0git+0x33e24)
#<!-- -->21 0x0000ffffa2bc6e4c (anonymous namespace)::FIRToLLVMLowering::runOnOperation() CodeGen.cpp:0:0
#<!-- -->22 0x0000ffffa52f64dc mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/opt/llvm/lib/libMLIRPass.so.20.0git+0x164dc)
#<!-- -->23 0x0000ffffa52f6f2c mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/opt/llvm/lib/libMLIRPass.so.20.0git+0x16f2c)
#<!-- -->24 0x0000ffffa52f9468 mlir::PassManager::run(mlir::Operation*) (/opt/llvm/lib/libMLIRPass.so.20.0git+0x19468)
#<!-- -->25 0x0000ffffa91140b0 Fortran::frontend::CodeGenAction::generateLLVMIR() (/opt/llvm/lib/libflangFrontend.so.20.0git+0x640b0)
#<!-- -->26 0x0000ffffa9117c8c Fortran::frontend::CodeGenAction::executeAction() (/opt/llvm/lib/libflangFrontend.so.20.0git+0x67c8c)
#<!-- -->27 0x0000ffffa910b0bc Fortran::frontend::FrontendAction::execute() (/opt/llvm/lib/libflangFrontend.so.20.0git+0x5b0bc)
#<!-- -->28 0x0000ffffa90f60c0 Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/opt/llvm/lib/libflangFrontend.so.20.0git+0x460c0)
#<!-- -->29 0x0000ffffa96b356c Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/opt/llvm/lib/libflangFrontendTool.so.20.0git+0x356c)
#<!-- -->30 0x0000aaaaae6943d4 fc1_main(llvm::ArrayRef<char const*>, char const*) (/opt/llvm/bin/flang-new+0x43d4)
#<!-- -->31 0x0000aaaaae69345c main (/opt/llvm/bin/flang-new+0x345c)
#<!-- -->32 0x0000ffffa7d884c4 (/usr/lib/aarch64-linux-gnu/libc.so.6+0x284c4)
#<!-- -->33 0x0000ffffa7d88598 __libc_start_main (/usr/lib/aarch64-linux-gnu/libc.so.6+0x28598)
#<!-- -->34 0x0000aaaaae6927f0 _start (/opt/llvm/bin/flang-new+0x27f0)
flang-new: error: unable to execute command: Aborted (core dumped)
flang-new: error: flang frontend command failed due to signal (use -v to see invocation)
flang-new version 20.0.0git (https://github.com/llvm/llvm-project 68f31aaae95f9824e58001c7f9115034df51039e)
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/llvm/bin
Build config: +assertions
flang-new: note: diagnostic msg: |
tblah
added a commit
to tblah/llvm-project
that referenced
this issue
May 6, 2025
Fixes llvm#108136 In llvm#108136 (the new testcase), flang was missing the length parameter required for the variable length string when boxing the global variable. The code that is initializing global variables for OpenMP did not support types with length parameters. Instead of duplicating this initialization logic in OpenMP, I decided to use the exact same initialization as is used in the base language because this will already be well tested and will be updated for any new types. The difference for OpenMP is that the global variables will be zero initialized instead of left undefined. Previously `Fortran::lower::createGlobalInitialization` was used to share a smaller amount of the logic with the base language lowering. I think this bug has demonstrated that helper was too low level to be helpful, and it was only used in OpenMP so I have made it static inside of ConvertVariable.cpp.
tblah
added a commit
that referenced
this issue
May 7, 2025
Fixes #108136 In #108136 (the new testcase), flang was missing the length parameter required for the variable length string when boxing the global variable. The code that is initializing global variables for OpenMP did not support types with length parameters. Instead of duplicating this initialization logic in OpenMP, I decided to use the exact same initialization as is used in the base language because this will already be well tested and will be updated for any new types. The difference for OpenMP is that the global variables will be zero initialized instead of left undefined. Previously `Fortran::lower::createGlobalInitialization` was used to share a smaller amount of the logic with the base language lowering. I think this bug has demonstrated that helper was too low level to be helpful, and it was only used in OpenMP so I have made it static inside of ConvertVariable.cpp.
GeorgeARM
pushed a commit
to GeorgeARM/llvm-project
that referenced
this issue
May 7, 2025
Fixes llvm#108136 In llvm#108136 (the new testcase), flang was missing the length parameter required for the variable length string when boxing the global variable. The code that is initializing global variables for OpenMP did not support types with length parameters. Instead of duplicating this initialization logic in OpenMP, I decided to use the exact same initialization as is used in the base language because this will already be well tested and will be updated for any new types. The difference for OpenMP is that the global variables will be zero initialized instead of left undefined. Previously `Fortran::lower::createGlobalInitialization` was used to share a smaller amount of the logic with the base language lowering. I think this bug has demonstrated that helper was too low level to be helpful, and it was only used in OpenMP so I have made it static inside of ConvertVariable.cpp.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Crash itself is reproducible on Godbolt:
https://godbolt.org/z/5j5cYMf3f
Reproducer:
Stack dump:
The text was updated successfully, but these errors were encountered: