bad fisher.test() bug (PR#1662)

maechler@stat.math.ethz.ch maechler@stat.math.ethz.ch
Thu, 13 Jun 2002 12:17:08 +0200 (MET DST)


(CC'ed to R-bugs  ``for the record'')

>>>>> "BDR" == Prof Brian D Ripley <ripley@stats.ox.ac.uk> writes:

    BDR> On Thu, 13 Jun 2002, Martin Maechler wrote:
    >> >>>>> "MM" == Martin Maechler
    >> <maechler@stat.math.ethz.ch> writes:
    >> 
    >> >>>>> "BDR" == Brian D Ripley <ripley@stats.ox.ac.uk>
    >> writes:
    BDR> Martin, What makes this a `bad bug'?  Are you getting a
    BDR> seg fault?
    >>
    MM> yes, always in the half a dozen restarts I tried.
    >>  (in the mean time I had one case where it did not ..)
    >> 
    BDR> Like Uwe this works for me the first few times and I do
    BDR> then get a backtrace (in memory.c, so this is almost
    BDR> certainly an earlier overrun).
    >>
    MM> I see.  This has been different for me.
    >>
    BDR> I think we've had problems before with FEXACT
    BDR> incorrectly specifying the required sizes of its
    BDR> workspaces.
    >>  (I'm not so sure this is the problem here.)
    >> 
    >> I found that
    >> 
    >> fisher.test(d4[1:30,])
    >> 
    >> gives a direct segmentation fault (without any error
    >> message) for me.
    >> 

    BDR> I've had to compile up gdb 5.2 to get the correct
    BDR> information out of R on Linux compiled under gcc-3.1.
    BDR> That shows (on the original problem)

    BDR> Loaded symbols for
    BDR> /users/ripley/R/R-patched/library/ctest/libs/ctest.so
    BDR> #0 f3xact (nrow=0x40051074, irow=0x4005113c,
    BDR> ncol=0x40051000, icol=0x40051120, dlp=0x4041b110,
    BDR> mm=0x40050fc0, fact=0x4035f020, ico=0x4035f4dc,
    BDR> iro=0x4035f5a4, it=0x4035f66c, lb=0x4035f734,
    BDR> nr=0x4035f7fc, nt=0x4035f8c4, nu=0x4035f98c,
    BDR> itc=0x4035fa54, ist=0x40360094, stv=0x40364f18,
    BDR> alen=0x40365ba0, tol=0x4004f878) at
    BDR> /users/ripley/R/cvs/R-patched/src/library/ctest/src/fexact.c:1125
    BDR> 1125 ist[itp] = -1; (gdb) print itp $1 = -3544

    BDR> The same with your variant (except the value of itp).

Okay, I found a much smaller table  --- and a different place
for the seg.fault :
> fisher.test(cbind(0,c(0,0,1)))

Program received signal SIGSEGV, Segmentation fault.
f2xact (nrow=0x8a12ec0, ncol=0x8a12ee0, table=0x8b7bb38, ldtabl=0x8a12f00, 
    expect=0x89dad68, percnt=0x89dad90, emin=0x89dadb8, prt=0x89dade0, 
    pre=0x89dae08, fact=0x403b3020, ico=0x403b302c, iro=0x403b3038, 
    kyy=0x403b3044, idif=0x403b3050, irn=0x403b3058, key=0x403b49d4, 
    ldkey=0xbfffc398, ipoin=0x403b5d44, stp=0x403b70b0, ldstp=0xbfffc39c, 
    ifrq=0x403ffef4, dlp=0x4046d450, dsp=0x4046fb30, tm=0x40472210, 
    key2=0x404748f4, iwk=0x403b3060, rwk=0x403b3d30)
    at ../../../../../R/src/library/ctest/src/fexact.c:524
524		obs += fact[ico[j]] - dd;

Martin



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._