This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
Re: [Bug malloc/6527] [powerpc] Malloc alignment insufficient for PowerPC
- From: OndÅej BÃlka <neleai at seznam dot cz>
- Cc: glibc-bugs at sourceware dot org
- Date: Thu, 11 Dec 2014 22:06:17 +0100
- Subject: Re: [Bug malloc/6527] [powerpc] Malloc alignment insufficient for PowerPC
- Authentication-results: sourceware.org; auth=none
- References: <bug-6527-131 at http dot sourceware dot org/bugzilla/> <bug-6527-131-8eI2zq4zCl at http dot sourceware dot org/bugzilla/>
- Ro: "joost.vandevondele at mat dot ethz.ch" <sourceware-bugzilla at sourceware dot org>
On Thu, Dec 11, 2014 at 08:30:13PM +0000, joost.vandevondele at mat dot ethz.ch wrote:
> --- Comment #9 from Joost VandeVondele <joost.vandevondele at mat dot ethz.ch> ---
> (In reply to joseph@codesourcery.com from comment #6)
> > I don't think malloc should try to provide alignment for vector types,
> > only C standard types and types from C standard extensions defined in a
> > way that makes them types for which malloc should provide alignment; other
> > functions such as aligned_alloc should be used when bigger alignment is
> > required. That leaves powerpc (long double) and 32-bit x86 (_Decimal128,
> > __float128 / future standard _Float128) as the only affected cases, I
> > think.
>
> but now that gcc is autovectorizing code, it might lead to binaries with
> results that randomly change depending on the alignment of the pointer returned
> by malloc. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64247
>
As I wrote in link that is not problem of malloc. Results there vary
because compiler can reassociate floating operations in fortran code.
If you compiled with different gcc version or copied array to one
misaligned by 4 bytes you would also get diffent result.