[Rd] Rubbish values written with zero-length vectors (PR#14217)

Peter Dalgaard p.dalgaard at biostat.ku.dk
Sat Feb 20 16:50:24 CET 2010


g.russell at eos-solutions.com wrote:
> Full_Name: George Russell
> Version: 2.10.0, 2.11.0 (2009-12-13 r50716)
> OS: Windows
> Submission from: (NULL) (217.111.3.131)
> 
> 
> R trace:
> -- cut here --
>> v <- integer(0)
>> v[[1]] <- v
>> v
> [1] 20522144
>> v <- numeric(0)
>> v[[1]] <- v
>> v
> [1] 4.254131e-314
>> sessionInfo()
> R version 2.10.0 (2009-10-26) 
> i386-pc-mingw32 
> 
> locale:
> [1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252   
> [3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C                   
> [5] LC_TIME=German_Germany.1252    
> 
> attached base packages:
> [1] stats     graphics  grDevices datasets  utils     methods   base     
> -- cut here --
> Clearly the assignments v[[1]] <- v do not do anything useful, the problem is I
> don't understand where the strange values left in v come from.

You don't want to understand, believe me! ;-)

It's a bug, probably not the very worst kind, but accessing memory that 
isn't yours is potentially harmful (but writing to it is considerably 
worse).

Looks like the issue only concerns the right hand side; nothing to do 
with the auto-expansion of v. I also get

 > v <- integer(0)
 > u <- integer(1)
 > u[[2]] <-v
 > u
[1]         0 142000760
 > u[[1]] <-v
 > u
[1] 142000760 142000760
 > a <- 1
 > a[[1]] <-v
 > a
[1] 142000760


> 
> The same problem occurs with the 2.11.0 release r50716 and --vanilla. For
> vanilla in Windows CMD mode I get different values in v, but ones which are to
> me equally strange.
> 
> Many thanks for your help!
> 
> George Russell
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel


-- 
    O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
   c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
  (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)              FAX: (+45) 35327907



More information about the R-devel mailing list