deepayan@stat.wisc.edu
2004-Oct-29 23:33 UTC
[Rd] (inappropriate) manipulation of expression objects causes segfault (PR#7326)
> version_ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status Under development (unstable) major 2 minor 1.0 year 2004 month 10 day 25 language R> > foo <- expression(alpha, beta, gamma) > foo[2]expression(beta)> foo[2] <- NA > foo ## or str(foo)Segmentation fault (Same behaviour in R 1.9.1) 'foo[[2]] <- NA' works fine, though. Deepayan
Peter Dalgaard
2004-Oct-29 23:53 UTC
[Rd] (inappropriate) manipulation of expression objects causes segfault (PR#7326)
deepayan@stat.wisc.edu writes:> > foo <- expression(alpha, beta, gamma) > > foo[2] > expression(beta) > > foo[2] <- NA > > foo ## or str(foo) > Segmentation fault > > (Same behaviour in R 1.9.1) > > 'foo[[2]] <- NA' works fine, though.Right. The NA is not important; foo[2] <- 1 crashes R just as effectively. We should likely either give an error or demote [ to [[. The latter is what happens with lists, and expressions are basically just list of call objects (or names or constants). To wit:> x <- list(1,2,3) > x[2] <- 1 > x[[1]] [1] 1 [[2]] [1] 1 [[3]] [1] 3 -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907