Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGZILLA #17330] [[<- for index 2^31 fails #6505

Open
MichaelChirico opened this issue May 19, 2020 · 2 comments
Open

[BUGZILLA #17330] [[<- for index 2^31 fails #6505

MichaelChirico opened this issue May 19, 2020 · 2 comments

Comments

@MichaelChirico
Copy link
Owner

This fails.
x <- raw()
x[[2^31]] <- as.raw(1)

Result:
Error in x[[2^31]] <- as.raw(1) :
attempt to select less than one element in integerOneIndex

Also this.
x <- raw(2^31)
x[[2^31]] <- as.raw(1)

Result:
Error in x[[2^31]] <- as.raw(1) :
attempt to select more than one element in integerOneIndex

This succeeds.
x <- raw()
x[2^31] <- as.raw(1)

Output of sessionInfo() :
R version 3.3.2 (2016-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.1 LTS

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics grDevices utils datasets methods base

It was in http://rextester.com/l/r_online_compiler .

It seems that the culprit is cast to int in this part of function 'OneIndex' in subscript.c.
indx = integerOneIndex((int)REAL(s)[pos], len, call);

It is still like that in R devel r73136.


METADATA

  • Bug author - Suharto Anggono
  • Creation time - 2017-08-26 02:17:56 UTC
  • Bugzilla link
  • Status - UNCONFIRMED
  • Alias - None
  • Component - Low-level
  • Version - R 3.3.*
  • Hardware - x86_64/x64/amd64 (64-bit) Linux-Ubuntu
  • Importance - P5 minor
  • Assignee - R-core
  • URL -
  • Modification time - 2017-08-31 17:15 UTC
@MichaelChirico
Copy link
Owner Author

Extraction by '[[' succeeds.
x <- raw(2^31)
x[[2^31]]


METADATA

  • Comment author - Suharto Anggono
  • Timestamp - 2017-08-26 05:39:15 UTC

@MichaelChirico
Copy link
Owner Author

Created attachment 2291 [details]
Against R-devel r73166, subscript.c: OneIndex: follow 'get1index'


METADATA

  • Comment author - Suharto Anggono
  • Timestamp - 2017-08-31 17:15:13 UTC

INCLUDED PATCH

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant