reactorlabs / rir

GNU General Public License v2.0
62 stars 18 forks source link

Wrong optimization in Extract2_2D for VECSXP #1255

Closed fikovnik closed 9 months ago

fikovnik commented 9 months ago

Similarly to #1253 , the Extract2_2D is also broken for VECSXP:

forceosr <- rir.compile(function(x) x)

fail <- function(x) {
    x <- strsplit(x, "[[:space:]]*=[[:space:]]*")
    x <- as.matrix(x)
    x <- forceosr(x)
    x[[1L,1L]]
}

test <- rir.compile(function() {
    fail("a")
    rir.markFunction(forceosr, Reopt = TRUE)
    fail("a")
})

# For a scalar generic vector (i.e., a list), our Extract2_1D returned
# the list itself and not its first element (that only works for normal vectors)
stopifnot(is.character(test()))