Issue |
125916
|
Summary |
Bogus alignment mismatch diagnostic
|
Labels |
new issue
|
Assignees |
|
Reporter |
PJBoy
|
Testcase ( https://godbolt.org/z/o1b83cEbG )
```
#include <cstdint>
using UnalignedType [[gnu::aligned(1)]] = struct
{
uint32_t x;
};
alignas(4) UnalignedType alignedVariable{};
void f(UnalignedType)
{}
static_assert(alignof(UnalignedType) == 1);
static_assert(alignof(alignedVariable) == 4);
int main()
{
f(alignedVariable);
}
```
The diagnostic reported is
> passing 1-byte aligned argument to 4-byte aligned parameter `'this'` of `'UnalignedType'` may result in an unaligned pointer access `[-Walign-mismatch]`
> ` 18 | f(alignedVariable);`
> ` | ^`
However, the argument `alignedVariable` is 4-byte aligned, and I would expect `UnalignedType` to be a one-byte aligned parameter; the reported alignments seem to be reversed
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs