compiler/types: Don't place members in the previous substruct's end padding

With the following structures :

  struct StructA
     uint64_t value0;
     uint8_t  value1;

  struct TopStruct
     struct StructA a;
     uint8_t value3;

Currently offsetof(struct TopStruct, value3) = 9. While the same code
on the CPU gives offsetof(struct TopStruct, value3) = 16.

This is impacting OpenCL kernels we're trying to use to build
acceleration structures.

v2: Add comment/link to some description of the alignment/size

Cc: mesa-stable
Signed-off-by: Lionel Landwerlin <>
Reviewed-by: Jason Ekstrand <>
Part-of: <!16940>
182 jobs for !16940 with review/opencl-post-union-placement in 44 minutes and 36 seconds (queued for 20 seconds)
latest merge request