Skip to content

[Flang] Assertion `actual.isMutableBox() && "actual must be a mutable box"' failed. #158280

@k-arrows

Description

@k-arrows

Reproducer:

integer, allocatable :: a
call s((NULL(a)))
contains
    subroutine s(a)
        integer, allocatable :: a
        allocate(a)
        deallocate(a)
    end subroutine
end

With assertion-enabled flang, compiling the above reproducer results in the following assertion failure:

llvm-project/flang/lib/Lower/ConvertCall.cpp:1726: void prepareUserCallArguments(Fortran::lower::PreparedActualArguments &, Fortran::lower::CallerInterface &, mlir::FunctionType, (anonymous namespace)::CallContext &, llvm::SmallVector<CallCleanUp> &): Assertion `actual.isMutableBox() && "actual must be a mutable box"' failed.

Backtrace:

 #0 0x000075f1cc7b6717 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
 #1 0x000075f1cc7b3e15 llvm::sys::RunSignalHandlers()
 #2 0x000075f1cc7b74c5 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #3 0x000075f1cbe42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x000075f1cbe969fc __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #5 0x000075f1cbe969fc __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #6 0x000075f1cbe969fc pthread_kill ./nptl/pthread_kill.c:89:10
 #7 0x000075f1cbe42476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #8 0x000075f1cbe287f3 abort ./stdlib/abort.c:81:7
 #9 0x000075f1cbe2871b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#10 0x000075f1cbe39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#11 0x000075f1cb1d8997 prepareUserCallArguments(llvm::SmallVector<std::optional<Fortran::lower::PreparedActualArgument>, 1u>&, Fortran::lower::CallerInterface&, mlir::FunctionType, (anonymous namespace)::CallContext&, llvm::SmallVector<(anonymous namespace)::CallCleanUp, 1u>&) ConvertCall.cpp:0:0
#12 0x000075f1cb1cf0f6 genUserCall(llvm::SmallVector<std::optional<Fortran::lower::PreparedActualArgument>, 1u>&, Fortran::lower::CallerInterface&, mlir::FunctionType, (anonymous namespace)::CallContext&) ConvertCall.cpp:0:0
#13 0x000075f1cb1cd6ab genProcedureRef((anonymous namespace)::CallContext&) ConvertCall.cpp:0:0
#14 0x000075f1cb1cbef7 Fortran::lower::convertCallToHLFIR(mlir::Location, Fortran::lower::AbstractConverter&, Fortran::evaluate::ProcedureRef const&, std::optional<mlir::Type>, Fortran::lower::SymMap&, Fortran::lower::StatementContext&) 

(trace continues...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    crashPrefer [crash-on-valid] or [crash-on-invalid]flang:ir

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions