https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77330

--- Comment #8 from joseph at codesourcery dot com <joseph at codesourcery dot 
com> ---
On Tue, 23 Aug 2016, bernd.edlinger at hotmail dot de wrote:

> gcc assumes that malloc, calloc, realloc, strdup, strndup
> and anything with the __attribute__((__malloc__))
> returns a pointer that is aligned to MALLOC_ABI_ALIGNMENT bits.

That it makes this more conservative assumption for some optimization 
purposes is separate from the assumption that if you dereference a pointer 
to a type, that pointer, however you got it, meets the alignment 
requirements for the type.  __float128 is 16-byte-aligned, so GCC assumes 
any dereferenced pointer to it is also 16-byte-aligned, and it's the 
user's job to meet that requirement (by not using malloc for that 
allocation if it doesn't return sufficiently aligned memory).  There is no 
difference between __float128 and __m512 in this regard: a malloc that 
doesn't return suitably aligned memory isn't suitable for allocating 
storage for such objects, and if you use malloc to do so then GCC will 
assume that, at least for that particular allocation, the return value is 
suitably aligned.

Reply via email to