jhuber6 wrote:
> > > Incrementing by align is just a bug, of course the size is the real
> > > value. Whether we want to continue wasting space is another
> > > not-correctness discussion
> >
> >
> > Struct padding is pretty universal, AMDGPU seems the odd one out here. I
> > wouldn't mind it so much if it didn't require me to know which vendor I was
> > dealing with in the RPC implementation, but I suppose I could store that
> > information somewhere if we want to use a compressed option and we know it
> > works.
>
> It's not about struct padding, but the base alignment. Any pointer increment
> should be alignTo(ptr + size, align), not += align. The += align won't even
> work for large structs
Hm, that's what I'm doing in the `printf` implementation and it doesn't work
without that patch. When I look at the varargs struct it didn't have any
padding, which explained why `alignTo(ptr + size, align)` was wrong. So, I was
trying to do the following, `printf("%d%ld", 1, 1l)`. With this patch I get the
following,
```
0xbebebebe00000001
0x0000000000000001
```
Without this patch, I get this. As you can see there's no struct padding so the
8 byte value is right next to the 4 byte one.
```
0x0000000100000001
0xbebebebe00000000
```
https://github.com/llvm/llvm-project/pull/96370
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits