https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88085
--- Comment #17 from rguenther at suse dot de <rguenther at suse dot de> --- On Thu, 2 Sep 2021, petro.karashchenko at gmail dot com wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88085 > > --- Comment #16 from Petro Karashchenko <petro.karashchenko at gmail dot com> > --- > Again based on your description even if we go with putting "tolerance" on the > type should not work because in "typedef int tolerant_int > __attribute__((aligned(1)));" the "int" default alignment is 4 and we apply > "1", so according to "The @code{aligned} attribute specifies a MINIMUM > alignment for the variable or structure field, measured in bytes." the > compiler > should use the MAX of all alignments of the type MAX(4,1) is 4 and not 1. > > So > typedef int int_1 __attribute__((aligned(1))); > typedef int_1 int_2 __attribute__((aligned(2))); > typedef int_2 int_4 __attribute__((aligned(4))); > typedef int_4 int_8 __attribute__((aligned(8))); > typedef int_8 int_16 __attribute__((aligned(16))); > > int_16 a; > > Then a should get aligned on 16 and not on 1. It is (aligned to 16).