Thanks, committed a fix. Just made .backet.Index explicitly specify
.Machine$integer.max when allowAppend == TRUE. I was being too idealistic
there when it worked for my simple tests.

Michael

On Fri, Oct 29, 2010 at 3:08 PM, <luke@stat.uiowa.edu> wrote:

> I reduced an intermittent bug in IRanges to the following:
>
> nr <- 47
> idx <- 48:49
> for (i in 1:10000)
>    if (IRanges:::anyMissingOrOutside(idx, -nr, NULL)) browser()
>
> This should never enter the browser but does reliable for me with 10000
> reps.
> (R-devel and IRanges 1.9.1)
>
> The problem is code in IRanges:::.bracket.Index that does
>
>    function (idx, lx, nms = NULL, dup.nms = FALSE, asRanges = FALSE,
>              allowAppend = FALSE) {
>        ...
>        if (anyMissingOrOutside(idx, -lx, if (!allowAppend) lx))
>
> If allowAppend it TRUE then the 'upper' argument to
> anyMissingOroutside is NULL, and in anyMissingOrOutside this is
> converted by as.integer to integer(0), but the C code that is called
> looks at the first element without checking the length. Perhaps the
> simplest fix is for anyMissingOrOutside to test for NULL and use the
> default value in that case; it would probably be good for the C code
> to do a sanity check on types and lengths as well.
>
> Best,
>
> luke
>
> --
> Luke Tierney
> Statistics and Actuarial Science
> Ralph E. Wareham Professor of Mathematical Sciences
> University of Iowa                  Phone:             319-335-3386
> Department of Statistics and        Fax:               319-335-3017
>   Actuarial Science
> 241 Schaeffer Hall                  email:      luke@stat.uiowa.edu
> Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu
>
> _______________________________________________
> Bioc-devel@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>

	[[alternative HTML version deleted]]

