Issue |
150749
|
Summary |
[Flang] crashes when passing character(*) explicit-shape array to class(*) dummy argument
|
Labels |
flang:ir,
crash
|
Assignees |
|
Reporter |
k-arrows
|
Reproducer:
https://godbolt.org/z/54fYTKfvo
```f90
subroutine char_explicit_shape_array(a2)
interface
subroutine char_explicit_shape_array_uclass_callee(p)
class(*), pointer, intent(in) :: p(:)
end subroutine char_explicit_shape_array_uclass_callee
end interface
character(*), target :: a2(100)
call char_explicit_shape_array_uclass_callee(a2)
end subroutine char_explicit_shape_array
```
Backtrace:
```console
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-llvmflang-trunk-20250726/bin/flang -fc1 -triple x86_64-unknown-linux-gnu -S -mrelocation-model pic -pic-level 2 -pic-is-pie -target-cpu x86-64 -mllvm -x86-asm-syntax=intel -resource-dir /opt/compiler-explorer/clang-llvmflang-trunk-20250726/lib/clang/22 -mframe-pointer=all -o /app/output.s -x f95 /app/example.f90
#0 0x00000000041554f8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-llvmflang-trunk-20250726/bin/flang+0x41554f8)
#1 0x00000000041526c4 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#2 0x00007f1c5b242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#3 0x0000000005192c05 fir::ConvertFIRToLLVMPattern::integerCast(mlir::Location, mlir::ConversionPatternRewriter&, mlir::Type, mlir::Value, bool) const (/opt/compiler-explorer/clang-llvmflang-trunk-20250726/bin/flang+0x5192c05)
#4 0x00000000051686a0 EmboxCommonConversion<fir::cg::XEmboxOp>::getCharacterByteSize(mlir::Location, mlir::ConversionPatternRewriter&, fir::CharacterType, mlir::ValueRange) const (/opt/compiler-explorer/clang-llvmflang-trunk-20250726/bin/flang+0x51686a0)
#5 0x0000000005176d85 EmboxCommonConversion<fir::cg::XEmboxOp>::getSizeAndTypeCode(mlir::Location, mlir::ConversionPatternRewriter&, mlir::Type, mlir::ValueRange) const (/opt/compiler-explorer/clang-llvmflang-trunk-20250726/bin/flang+0x5176d85)
#6 0x0000000005176c91 EmboxCommonConversion<fir::cg::XEmboxOp>::getSizeAndTypeCode(mlir::Location, mlir::ConversionPatternRewriter&, mlir::Type, mlir::ValueRange) const (/opt/compiler-explorer/clang-llvmflang-trunk-20250726/bin/flang+0x5176c91)
#7 0x0000000005176f78 std::tuple<fir::BaseBoxType, mlir::Value, mlir::Value> EmboxCommonConversion<fir::cg::XEmboxOp>::consDescriptorPrefix<fir::cg::XEmboxOp>(fir::cg::XEmboxOp, mlir::Type, mlir::ConversionPatternRewriter&, unsigned int, mlir::ValueRange, mlir::ValueRange, mlir::Value, mlir::Type) const (/opt/compiler-explorer/clang-llvmflang-trunk-20250726/bin/flang+0x5176f78)
#8 0x000000000518482b XEmboxOpConversion::matchAndRewrite(fir::cg::XEmboxOp, fir::cg::XEmboxOpAdaptor, mlir::ConversionPatternRewriter&) const (/opt/compiler-explorer/clang-llvmflang-trunk-20250726/bin/flang+0x518482b)
#9 0x0000000005153a23 fir::FIROpConversion<fir::cg::XEmboxOp>::matchAndRewrite(mlir::Operation*, llvm::ArrayRef<mlir::ValueRange>, mlir::ConversionPatternRewriter&) const (/opt/compiler-explorer/clang-llvmflang-trunk-20250726/bin/flang+0x5153a23)
#10 0x000000000815bbb2 mlir::ConversionPattern::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&) const (/opt/compiler-explorer/clang-llvmflang-trunk-20250726/bin/flang+0x815bbb2)
#11 0x00000000081a4b04 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/compiler-explorer/clang-llvmflang-trunk-20250726/bin/flang+0x81a4b04)
#12 0x000000000815a480 (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*, mlir::ConversionPatternRewriter&) DialectConversion.cpp:0:0
#13 0x000000000815a577 mlir::OperationConverter::convert(mlir::ConversionPatternRewriter&, mlir::Operation*) (/opt/compiler-explorer/clang-llvmflang-trunk-20250726/bin/flang+0x815a577)
#14 0x000000000815d64b mlir::OperationConverter::convertOperations(llvm::ArrayRef<mlir::Operation*>) (/opt/compiler-explorer/clang-llvmflang-trunk-20250726/bin/flang+0x815d64b)
#15 0x000000000815e8ed applyConversion(llvm::ArrayRef<mlir::Operation*>, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig, (anonymous namespace)::OpConversionMode) DialectConversion.cpp:0:0
#16 0x000000000815ea4c mlir::applyFullConversion(mlir::Operation*, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig) (/opt/compiler-explorer/clang-llvmflang-trunk-20250726/bin/flang+0x815ea4c)
#17 0x00000000051752c7 (anonymous namespace)::FIRToLLVMLowering::runOnOperation() CodeGen.cpp:0:0
#18 0x00000000097ad371 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/opt/compiler-explorer/clang-llvmflang-trunk-20250726/bin/flang+0x97ad371)
#19 0x00000000097ad7d9 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/opt/compiler-explorer/clang-llvmflang-trunk-20250726/bin/flang+0x97ad7d9)
#20 0x00000000097ae579 mlir::PassManager::run(mlir::Operation*) (/opt/compiler-explorer/clang-llvmflang-trunk-20250726/bin/flang+0x97ae579)
#21 0x0000000004459d86 Fortran::frontend::CodeGenAction::generateLLVMIR() (/opt/compiler-explorer/clang-llvmflang-trunk-20250726/bin/flang+0x4459d86)
#22 0x000000000445f6a8 Fortran::frontend::CodeGenAction::executeAction() (/opt/compiler-explorer/clang-llvmflang-trunk-20250726/bin/flang+0x445f6a8)
#23 0x00000000041aebcd Fortran::frontend::FrontendAction::execute() (/opt/compiler-explorer/clang-llvmflang-trunk-20250726/bin/flang+0x41aebcd)
#24 0x000000000419cc3f Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/opt/compiler-explorer/clang-llvmflang-trunk-20250726/bin/flang+0x419cc3f)
#25 0x00000000041b7b4b Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/opt/compiler-explorer/clang-llvmflang-trunk-20250726/bin/flang+0x41b7b4b)
#26 0x00000000024b4c4a fc1_main(llvm::ArrayRef<char const*>, char const*) (/opt/compiler-explorer/clang-llvmflang-trunk-20250726/bin/flang+0x24b4c4a)
#27 0x0000000002359c06 main (/opt/compiler-explorer/clang-llvmflang-trunk-20250726/bin/flang+0x2359c06)
#28 0x00007f1c5b229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#29 0x00007f1c5b229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#30 0x00000000024b3605 _start (/opt/compiler-explorer/clang-llvmflang-trunk-20250726/bin/flang+0x24b3605)
flang-22: error: unable to execute command: Segmentation fault (core dumped)
flang-22: error: flang frontend command failed due to signal (use -v to see invocation)
flang version 22.0.0git (https://github.com/llvm/llvm-project.git 799f28d7a5f155ae5456c87a511fbd18498f6396)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/compiler-explorer/clang-llvmflang-trunk-20250726/bin
flang-22: note: diagnostic msg:
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs