Menu

#297 Crash due to "endplot"

v1.0_(example)
closed-fixed
nobody
None
5
2024-01-19
2024-01-12
No

Hi all,

using recent git version on Ubuntu, the following script leads to a crash of Gretl:

set verbose off

function void multiplot_single_var (const list L)
    strings Plots

    gpbuild Plots
        loop foreach i L
            plot L.$i
                options with-lines time-series
            endplot
        endloop
    end gpbuild

#    gridplot Plots --width=1100 --height=700 --fontsize=11 --output="@filename"
end function

open denmark -q
list L = dataset
multiplot_single_var(L)

Reason is the wrong command endplot instead of end plot.

Best
Artur

Discussion

  • Allin Cottrell

    Allin Cottrell - 2024-01-18

    Please supply a trace for the crash using gdb or (preferably) valgrind. I can't produce a crash here (tried on Linux and Mac) though I do of course get an error.

    The error condition arises because "endplot" does not end "plot", so "endloop" is encountered when still inside a plot block. Note that gretl doesn't actually try to execute the invalid "endplot" statement, since it's in "compile a loop" mode at the time.

     
  • Riccardo "Jack" Lucchetti

    Valgrind output attached
    
     
  • Allin Cottrell

    Allin Cottrell - 2024-01-19

    Thanks Jack and Luca. I'll attempt to explain what's going on before long. Meanwhile this should be fixed in git.

     
  • Artur Tarassow

    Artur Tarassow - 2024-01-19

    Thank you for fixing that, Allin. It works now in the sense that an error is thrown and gretl does not crash.

    I am going to close the ticket.

     
  • Artur Tarassow

    Artur Tarassow - 2024-01-19
    • status: open --> closed-fixed
     

Log in to post a comment.