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 #17327] Wrong integer display because of use of %ld #6502

Open
MichaelChirico opened this issue May 19, 2020 · 1 comment
Open

Comments

@MichaelChirico
Copy link
Owner

This is a follow-up of Bug 17292 Comment 7.

Using %ld for R_xlen_t doesn't give the desired result when the number is 2^31 or more for 64-bit R on Windows. On Windows, long is 32-bit.

Instances:

  • function 'do_psort' in sort.c
    Example usage in R:
    res <- sort(integer(2^31), partial = 2^31+1)

  • function 'inspect_tree' in inspect.c
    Example usage in R:
    .Internal(inspect(raw(2^31)))

For 32-bit R, in Rinternals.h, R_xlen_t is int and %d can be used.
For 64-bit R, in Rinternals.h, R_xlen_t is ptrdiff_t and %td can be used. Is it available everywhere?


METADATA

  • Bug author - Suharto Anggono
  • Creation time - 2017-08-19 09:57:33 UTC
  • Bugzilla link
  • Status - UNCONFIRMED
  • Alias - None
  • Component - Windows GUI / Window specific
  • Version - R-devel (trunk)
  • Hardware - x86_64/x64/amd64 (64-bit) Windows 64-bit
  • Importance - P5 minor
  • Assignee - R-core
  • URL -
  • Modification time - 2019-04-05 18:19 UTC
@MichaelChirico
Copy link
Owner Author

Another instance:

  • function 'do_nchar' in character.c
    Example usage in R:
    y <- "\xe7"
    Encoding(y) <- "bytes"
    x <- character(2^31)
    x[length(x)] <- y
    res <- nchar(x)

METADATA

  • Comment author - Suharto Anggono
  • Timestamp - 2019-04-05 18:19:00 UTC

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