In summary.c, in function 'isum', the loop is 'ITERATE_BY_REGION' that contains 'for' loop for (int k = 0; k < nbatch; k++) It is since SVN revision 73445, in released R since version 3.5.0. Previously, the loop is for (R_xlen_t i = 0; i < n; i++)
Inside 'ITERATE_BY_REGION', the type of the index, 'k', should still be 'R_xlen_t' as previously. If 'sx' is a regular vector (not ALTREP), data pointer is taken and 'nbatch' is the length of the vector, like without 'ITERATE_BY_REGION'. With 64-bit R, it is possible that the vector is a long vector. In that case, correct iteration should reach index outside the range of 'int'. However, I haven't found an example in 64-bit R of wrong behavior of sum(x) for 'x' with storage mode "integer" and length 2^31 or more. ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel