Unfortunately, since yesterday's change to fit.c I get a segfault
from the fit demo:
gnuplot> load 'fit.dem'
Some examples how data fitting using nonlinear least squares fit can be done.
We fit a straight line to the data -- only as a demo without physical meaning.
fit function:l(x) = y0 + m*x
initial parameters: y0 = 0, m = 0
fit command: fit l(x) 'lcdemo.dat' via y0, m
Now start fitting... (-> return)
fit: Deprecated syntax. Consider using the 'noerror' option, see `help fit`.
Program received signal SIGSEGV, Segmentation fault.
0x0000000000449672 in fit_command () at fit.c:1924
1924 err_data[num_data] = 1; /* constant weight */
(gdb) print num_data
$1 = 0
(gdb) print err_data
$2 = (double *) 0x0
((gdb) print max_data
$2 = 2048
(gdb) print num_errors
$4 = 0
So err_data is being allocated as length 0 because num_errors = 0.
But then it is accessed anyway.
What's the fix?
Ethan
|