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

core dependency on c_int in memcmp #32610

Closed
bluss opened this issue Mar 30, 2016 · 6 comments · Fixed by #90791
Closed

core dependency on c_int in memcmp #32610

bluss opened this issue Mar 30, 2016 · 6 comments · Fixed by #90791
Labels
C-bug Category: This is a bug. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@bluss
Copy link
Member

bluss commented Mar 30, 2016

libcore/str/mod.rs uses memcmp, and declares it to return i32, in reality it returns c_int, so this is a potential portability concern.

Maybe memcmp can be made an intrinsic to resolve this.

@tbu-
Copy link
Contributor

tbu- commented Apr 11, 2016

It also takes a size_t parameter, not a uintptr_t.

@bluss
Copy link
Member Author

bluss commented Apr 11, 2016

Neither of these are a practical issue (yet). crate libc does not support any other configuration than c_int = i32 so far.

@bluss
Copy link
Member Author

bluss commented Nov 1, 2016

cc @brson

@Mark-Simulacrum
Copy link
Member

The extern function is now in src/libcore/slice/mod.rs.

@Mark-Simulacrum Mark-Simulacrum added I-wrong T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Jun 22, 2017
@Mark-Simulacrum Mark-Simulacrum added C-cleanup Category: PRs that clean code up or issues documenting cleanup. C-bug Category: This is a bug. and removed C-cleanup Category: PRs that clean code up or issues documenting cleanup. I-wrong labels Jul 24, 2017
@tesuji
Copy link
Contributor

tesuji commented Feb 14, 2020

What should we do next? Should we try to create a memcmp intrinsic?

@drmorr0
Copy link
Contributor

drmorr0 commented Oct 30, 2021

Hi, I believe this issue is causing array comparisons on the AVR architecture to break (see the linked issue, #78022). Is there any consensus on a path forward here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants