Skip to content

Maybe some bug on sapply and cbind (PR#5628)

3 messages · David Brahm, Thomas Lumley, Luke Tierney

#
I can confirm this bug on Solaris 2.8 running R-1.8.1.  Here's a simplified
version:

y <- list()
sapply(1, function(i) y[[i]] <- expression(1))
cbind(1, rep(2,1))

  [ Process R segmentation Fault at Tue Dec  9 09:20:33 2003 ]

Curiously, replacing the third line with
  cbind(1, 2)
does not casue a crash, even though rep(2,1) == 2 !
platform sparc-sun-solaris2.8
arch     sparc               
os       solaris2.8          
system   sparc, solaris2.8   
status                       
major    1                   
minor    8.1                 
year     2003                
month    11                  
day      21                  
language R
#
On Tue, 9 Dec 2003 brahm@alum.mit.edu wrote:

            
Furthermore, it doesn't happen with lapply() or with sapply(,
simplify=FALSE), so it is linked to the simplify step

	-thomas
#
Simpler version seems to be

x <- list(expression(1))
y <- rep(2,1)
.Internal(unlist(x, FALSE, FALSE))
.Internal(cbind(1, y))

Seems to be related to undesirable behavior of unlist when expression
objects are involved;
NULL
[1] 150684992

luke
On Tue, 9 Dec 2003 brahm@alum.mit.edu wrote: