`__can_pass_in_regs(very-big-class)` wrong on x86-64
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
https://godbolt.org/z/qK33K7ahc
```cpp
struct A {
long data[1024*1024];
};
static_assert(__can_pass_in_regs(A));
```
x86-64 psABI:
> MEMORY This class consists of types that will be passed and returned in memory via the stack.
> ...
> If the size of an object is larger than eight eightbytes, or it contains unaligned fields, it has class MEMORY
Docs: https://clang.llvm.org/docs/LanguageExtensions.html#:~:text=%5F%5Fcan%5Fpass%5Fin%5Fregs
Contributor guide
Research direction
Reproduce the static assertion in the linked Godbolt example and read the __can_pass_in_regs documentation alongside the x86-64 psABI classification quoted in the issue. Trace how the builtin handles a very large class, then verify that a class exceeding eight eightbytes is treated as MEMORY and the assertion no longer passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100