Skip to content

Stackoverflow while attempting to show error due to malformed :(...) syntax #51572

@MasonProtter

Description

@MasonProtter

MWE:

julia> macro foo()
           Expr(:(...), 1, 2, 3)
       end
@foo (macro with 1 method)

julia> (@foo,)
# hangs for a couple minutes before...
ERROR: StackOverflowError:

if I interrupt before the stack overflow, I get

julia> (@foo,)
^C
SYSTEM (REPL): showing an error caused an error
ERROR: InterruptException:
Stacktrace:
  [1] lookup(pointer::Ptr{Nothing})
    @ Base.StackTraces ./stacktraces.jl:107
  [2] stacktrace(trace::Vector{Union{Ptr{Nothing}, Base.InterpreterIP}}, c_funcs::Bool)
    @ Base.StackTraces ./stacktraces.jl:163
  [3] stacktrace
    @ ./stacktraces.jl:161 [inlined]
  [4] scrub_repl_backtrace(bt::Vector{Union{Ptr{Nothing}, Base.InterpreterIP}})
    @ Base ./client.jl:95
  [5] scrub_repl_backtrace(stack::Base.ExceptionStack)
    @ Base ./client.jl:102
  [6] print_response(errio::IO, response::Any, show_value::Bool, have_color::Bool, specialdisplay::Union{Nothing, AbstractDisplay})
    @ REPL ~/julia/usr/share/julia/stdlib/v1.9/REPL/src/REPL.jl:298
  [7] (::REPL.var"#57#58"{REPL.LineEditREPL, Pair{Any, Bool}, Bool, Bool})(io::Any)
    @ REPL ~/julia/usr/share/julia/stdlib/v1.9/REPL/src/REPL.jl:287
  [8] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL ~/julia/usr/share/julia/stdlib/v1.9/REPL/src/REPL.jl:557
  [9] print_response(repl::REPL.AbstractREPL, response::Any, show_value::Bool, have_color::Bool)
    @ REPL ~/julia/usr/share/julia/stdlib/v1.9/REPL/src/REPL.jl:285
 [10] (::REPL.var"#do_respond#80"{Bool, Bool, REPL.var"#93#103"{REPL.LineEditREPL, REPL.REPLHistoryProvider}, REPL.LineEditREPL, REPL.LineEdit.Prompt})(s::REPL.LineEdit.MIState, buf::Any, ok::Bool)
    @ REPL ~/julia/usr/share/julia/stdlib/v1.9/REPL/src/REPL.jl:899
 [11] #invokelatest#2
    @ ./essentials.jl:819 [inlined]
 [12] invokelatest
    @ ./essentials.jl:816 [inlined]
 [13] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
    @ REPL.LineEdit ~/julia/usr/share/julia/stdlib/v1.9/REPL/src/LineEdit.jl:2647
 [14] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
    @ REPL ~/julia/usr/share/julia/stdlib/v1.9/REPL/src/REPL.jl:1300
 [15] (::REPL.var"#62#68"{REPL.LineEditREPL, REPL.REPLBackendRef})()
    @ REPL ./task.jl:514

I've tested and confirmed this on v1.9, 1.8 and nightly. Interestingly, if I try this on nightly though, the stack overflow is practically instant so I don't get a chance to interrupt it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorcompiler:loweringSyntax lowering (compiler front end, 2nd stage)

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions