# repr(C) AIX Struct Alignment

**URL:** <https://internals.rust-lang.org/t/repr-c-aix-struct-alignment/21594>\
**Category:** compiler\
**Created:** [September 25, 2024, 6:22pm UTC](https://internals.rust-lang.org/t/repr-c-aix-struct-alignment/21594 "2024-09-25T18:22:28Z")\
**Posts on this page:** 1\
**Showing post:** 44

<div class="post-metadata">

**Author:** ![RalfJung](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/ralfjung/32/2415_2.png) [@RalfJung](https://internals.rust-lang.org/u/RalfJung)\
**Post date:** [June 11, 2025, 10:18am UTC](https://internals.rust-lang.org/t/repr-c-aix-struct-alignment/21594/44 "2025-06-11T10:18:39Z")

</div>

> [@workingjubilee](#):
>
> So, I've found out that I was wrong, but I was wrong in a way that is worse for everyone, sortof: The AIX "alignment rule" seems to actually just be an extremely convoluted way of saying "this is sometimes overaligned when it is put on the stack".

Uh, how sure are we about this?

I found [this example](https://www.ibm.com/docs/en/xl-c-and-cpp-aix/16.1.0?topic=modes-alignment-aggregates)

```C
struct Struct1 {  
  double a1;    
  char a2;
};

```

Apparently this is supposed to have size 16, because "the member with the largest alignment requirement is `a1`; therefore, `a2` is padded with 7 bytes". If we just set `double` to have alignment 4, we'll give this struct size 12.

---

_[View the full topic](https://internals.rust-lang.org/t/repr-c-aix-struct-alignment/21594)._
