Skip to content
New issue

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

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

Already on GitHub? # to your account

repr(C) on enums is unsound on hexagon-unknown-linux-gnu #82100

Closed
mahkoh opened this issue Feb 14, 2021 · 1 comment · Fixed by #82379
Closed

repr(C) on enums is unsound on hexagon-unknown-linux-gnu #82100

mahkoh opened this issue Feb 14, 2021 · 1 comment · Fixed by #82379
Labels
C-bug Category: This is a bug.

Comments

@mahkoh
Copy link
Contributor

mahkoh commented Feb 14, 2021

Enums on hexagon-unknown-linux-gnu are packed by default: https://godbolt.org/z/q49s5v

This is not implemented in rustc atm

if repr.c() {
match &tcx.sess.target.arch[..] {
// WARNING: the ARM EABI has two variants; the one corresponding
// to `at_least == I32` appears to be used on Linux and NetBSD,
// but some systems may use the variant corresponding to no
// lower bound. However, we don't run on those yet...?
"arm" => min_from_extern = Some(I32),
_ => min_from_extern = Some(I32),
}
}

@mahkoh mahkoh added the C-bug Category: This is a bug. label Feb 14, 2021
@mahkoh mahkoh changed the title repr(C) is unsound on hexagon-unknown-linux-gnu repr(C) on enums is unsound on hexagon-unknown-linux-gnu Feb 14, 2021
@RalfJung
Copy link
Member

This looks like an incorrect ABI implementation then, but as long as Rust is self-consistent, "unsound" is the wrong term here I think?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants