Closed fikovnik closed 11 months ago
A reproduction from @JanJecmen :
forceosr <- rir.compile(function(x) x)
fail <- function(x) {
x <- strsplit(x, "[[:space:]]*=[[:space:]]*")
x <- forceosr(x)
x[[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()))
In
lower_function_llvm.cpp
, the compilation of the fast path of Extract2_1D is wrong for generic scalar vectors:A scalar vector:
accessed by
a[[1L]]
should return its first elementBut in the current implementation, it returns itself:
This happens in either OSR or deopt where the
ContinuationContext
is created from the actual types of theSEXP
s in the current environment.There are two ways to fix:
VECSXP
(inpir/type.cpp
)The latter makes more sense.