This solution is not satisfactory as programmers have to readjust the padding for each modification of the top level or encapsulated structures and check it's correctness on all supported platforms.
Instead we can readjust the size of the allocated structures in the custom memory allocators that we have (SysV shared memory ones) according to the platform's alignment requirements.
Additionally we must check whether GCC violates Sparc ABI in regards to structure member access as starting from version 3 it has -mfaster-structs command line argument which breaks Sparc ABI. The symptoms for
ZBX-5289 (crash upon structure access with std instruction) matches the description of this argument. It could be that GCC turns this argument on for optimization. If this is indeed true then we should somehow warn our customers about such compiler behaviour.
With -mfaster-structs, the compiler assumes that structures should have 8 byte alignment. This enables the use of pairs of ldd and std instructions for copies in structure assignment, in place of twice as many ld and st pairs. However, the use of this changed alignment directly violates the SPARC ABI. Thus, it's intended only for use on targets where the developer acknowledges that their resulting code will not be directly in line with the rules of the ABI.