[clang] [ARM, AArch64] Fix ABI bugs with over-sized bitfields (PR #126774)
Florian Mayer via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 29 12:29:08 PDT 2025
fmayer wrote:
This changed the size of the following struct:
```
#include <stdint.h>
struct A {
bool value : 64 = false;
uint64_t : 448;
};
static_assert(sizeof(A) == 64);
```
Used to be 64 but became 80. I bisected to this change.
```
$ llvm-project/build/bin/clang++ -target aarch64 -c foo.c
clang++: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
foo.c:4:22: warning: default member initializer for bit-field is a C++20 extension [-Wc++20-extensions]
4 | bool value : 64 = false;
| ^
foo.c:8:15: error: static assertion failed due to requirement 'sizeof(A) == 64'
8 | static_assert(sizeof(A) == 64);
| ^~~~~~~~~~~~~~~
foo.c:8:25: note: expression evaluates to '80 == 64'
8 | static_assert(sizeof(A) == 64);
| ~~~~~~~~~~^~~~~
1 warning and 1 error generated.
```
```
% clang++-19 -target aarch64 -c foo.c
clang++-19: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
foo.c:4:22: warning: default member initializer for bit-field is a C++20 extension [-Wc++20-extensions]
4 | bool value : 64 = false;
| ^
1 warning generated.
```
https://github.com/llvm/llvm-project/pull/126774
More information about the cfe-commits
mailing list