Skip to content

Commit

Permalink
Fix calling XLENGTH on S4SXP (fixes #1289)
Browse files Browse the repository at this point in the history
  • Loading branch information
fikovnik authored Jun 21, 2024
1 parent 189a62b commit 95582fb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion rir/src/interpreter/interp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3590,7 +3590,8 @@ SEXP evalRirCode(Code* c, SEXP env, const CallContext* callCtxt,
(valT == REALSXP || valT == INTSXP)) || // 2
(vectorT == INTSXP && valT == INTSXP) ||
(vectorT == VECSXP && val != R_NilValue)) &&
(XLENGTH(val) == 1 || vectorT == VECSXP)) { // 3
((valT != S4SXP && XLENGTH(val) == 1) ||
vectorT == VECSXP)) { // 3

int idx_ = -1;

Expand Down
2 changes: 1 addition & 1 deletion rir/src/runtime/TypeFeedback.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ struct ObservedValues {
// > .Internal(inspect(mf[["x"]]))
// @56546cb06390 14 REALSXP g0c3 [OBJ,NAM(2)] (len=3, tl=0) 41,42,43

notScalar = notScalar || XLENGTH(e) != 1;
notScalar = notScalar || (TYPEOF(e) != S4SXP && XLENGTH(e) != 1);
object = object || Rf_isObject(e);
attribs = attribs || object || ATTRIB(e) != R_NilValue;
notFastVecelt = notFastVecelt || !fastVeceltOk(e);
Expand Down

0 comments on commit 95582fb

Please sign in to comment.