(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