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

volatile int is trivially copyable but not trivially relocatable #77091

Closed
AMP999 opened this issue Jan 5, 2024 · 1 comment · Fixed by #77092
Closed

volatile int is trivially copyable but not trivially relocatable #77091

AMP999 opened this issue Jan 5, 2024 · 1 comment · Fixed by #77092
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema"

Comments

@AMP999
Copy link
Contributor

AMP999 commented Jan 5, 2024

https://godbolt.org/z/4Y9z7sdEE
This Godbolt shows that clang considers struct S { volatile int i; }; "trivially relocatable", but volatile int is considered "not-trivially relocatable". This is inconsistent. It's also inconsistent with the behavior of std::is_trivially_copyable_v<volatile int> == true. __is_trivially_relocatable should do the same. Otherwise, we end up with a type that is trivially copyable but not trivially relocatable.

@EugeneZelenko EugeneZelenko added clang:frontend Language frontend issues, e.g. anything involving "Sema" and removed new issue labels Jan 5, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Jan 5, 2024

@llvm/issue-subscribers-clang-frontend

Author: Amirreza Ashouri (AMP999)

https://godbolt.org/z/4Y9z7sdEE This Godbolt shows that clang considers `struct S { volatile int i; };` "trivially relocatable", but `volatile int` is considered "not-trivially relocatable". This is inconsistent. It's also inconsistent with the behavior of `std::is_trivially_copyable_v<volatile int> == true`. `__is_trivially_relocatable` should do the same. Otherwise, we end up with a type that is trivially copyable but not trivially relocatable.

AMP999 added a commit to AMP999/llvm-project that referenced this issue Jan 10, 2024
Consistent with `__is_trivially_copyable(volatile int) == true`
and `__is_trivially_relocatable(volatile Trivial) == true`,
`__is_trivially_relocatable(volatile int)` should also be `true`.

Fixes llvm#77091

[clang] [test] New tests for __is_trivially_relocatable(cv-qualified type)
AMP999 added a commit to AMP999/llvm-project that referenced this issue Feb 12, 2024
Consistent with `__is_trivially_copyable(volatile int) == true`
and `__is_trivially_relocatable(volatile Trivial) == true`,
`__is_trivially_relocatable(volatile int)` should also be `true`.

Fixes llvm#77091

[clang] [test] New tests for __is_trivially_relocatable(cv-qualified type)
cor3ntin pushed a commit that referenced this issue Mar 11, 2024
…77092)

Consistent with `__is_trivially_copyable(volatile int) == true` and
`__is_trivially_relocatable(volatile Trivial) == true`,
`__is_trivially_relocatable(volatile int)` should also be `true`.

Fixes #77091

[clang] [test] New tests for __is_trivially_relocatable(cv-qualified
type)
ilovepi pushed a commit to ilovepi/llvm-project that referenced this issue Mar 15, 2024
…lvm#77092)

Consistent with `__is_trivially_copyable(volatile int) == true` and
`__is_trivially_relocatable(volatile Trivial) == true`,
`__is_trivially_relocatable(volatile int)` should also be `true`.

Fixes llvm#77091

[clang] [test] New tests for __is_trivially_relocatable(cv-qualified
type)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema"
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants