------- Additional Comments From mark at codesourcery dot com 2005-04-17 02:43 ------- Subject: Re: [4.0/4.1 Regression] Miscompilation with __attribute ((aligned))
jsm28 at gcc dot gnu dot org wrote: > ------- Additional Comments From jsm28 at gcc dot gnu dot org 2005-04-16 > 16:15 ------- > Much the same issue can arise with array references through > pointer-to-aligned-type, and with arithmetic on such pointers, as does with > array-of-aligned-type. Agreed. > The obvious options include: > > * Make a new type of larger size to match the alignment whenever e.g. an > 8-byte-aligned-int is requested. (Probably breaks too much.) > > * Disallow arrays of extra-aligned types, and array references and pointer > arithmetic on such types; either with an error, or with a warning and removal > of > the "aligned" attribute (in the case of arrays, attaching it to the array; in > the case of pointers, causing the results of the arithmetic to have the > ordinary > type without alignment). As a C front-end maintainer, which of these options do you prefer? It sounds like you, like me, favor the second option, but I'd like to be sure. > We could also add a target_aligned attribute which can be used to describe the > alignment of a pointer's target, to use for pointers to the start of an array > where the start is aligned but the individual elements aren't. That sounds plausible, but should, IMO, be done after first implementing one of your options above. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20794