Hi,
While working on the replication of Hyndman's book, Claude found a bug.
deseas() with seats=1 segfaults for some sample windows of aus_production.gdt (attached) Gas (automatic ARIMA, logtrans=1)
Environment: gretl 2026d-git; x13as at /usr/bin/x13as (Debian package)
Steps to reproduce:
# Monthly data (T=202) -> works
open hamilton.gdt
bundle B = _(output="all", logtrans=1, seats=1)
series s = deseas(PC6IT, &B)
# Quarterly data (T=218) -> crash
open aus_production.gdt
# smpl obs >= 1980:1 --restrict --permanent # would run it fine!
bundle B = _(output="all", logtrans=1, seats=1)
series s = deseas(Gas, &B)
Expected: SEATS decomposition is returned, as it is with seats=0 on the same series.
Actual: gretl terminates with a segfault (exit code 139).
Sample windows tested (Gas, logtrans=1, seats=1, default ARIMA selection):
| Sample | T | Result |
|---|---|---|
| 1956:1–2010:2 | 218 | crash |
| 1956:1–1980:4 | 100 | ok |
| 1956:1–1981:4 | 104 | ok |
| 1956:1–1983:4 | 112 | ok |
| 1956:1–1984:4 | 116 | crash |
| 1956:1–1985:4 | 120 | crash |
| 1960:1–1990:4 | 124 | ok |
| 1980:1–2000:4 | 84 | ok |
| 1980:1–2010:2 | 122 | ok |
1956:1–2010:2, seats=0 |
218 | ok |
Further observations:
hamilton.gdt series (T=202) runs without error.airline=1 on the full sample runs without error, as does logtrans=0.output="sa" and verbose=1 on the full sample, the run fails with "Bei Fehler beendet" and a missing ~/.gretl/x12arima/Gas.s11 file. This may be a second symptom of the same problem.Gas is of type integer (don't know this is really relevant)Workarounds:
airline=1logtrans=0Not yet investigated: whether the failing windows share a common cause, such as a particular observation or the model x13as selects.
Best,
Artur
I just pushed to git what I believe is a fix: basically, in the case you reported x13 finished with an error, and we were trying to fill the returned series with values from a no-longer-existing matrix.
Thank you, @jacklucchetti. I think also @allin has pushed something on this.
Overall, I now obtain an error message instead of a crash.
Thank you for the quick fix, Jack and Allin!
Shall we close the ticket, or anything left?
Artur
Well, there's one thing left. The crash that Jack fixed was specific to the case where we get an error from x13as. Why did we get an error? It seems that x13as itself segfaulted when calling the SEATS code. Not exactly a bug in x13as, but due to out-of-date fortran code which gfortran used to work around but not (by default) any more. I'm in the process of replacing the gretl builds of x13as that exhibit this problem with new builds using the gfortran flag "-std=legacy", which reinstates the workaround. Plus, Claude pointed something out: in the specific crashing case there was also a "legitimate" error from SEATS: an inadmissible decomposition with negative spectrum. By default SEATS flags an error in such cases, but by setting noadmiss="yes" we could get it to reformulate the model to obtain an admissible decomp. Claude sugegsted we might want to add an option to that effect to our deseas() function.