This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: x86/64 alignment, optimization, -Wcast-align
- From: Balázs Oroszi <orobalage at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Wed, 26 Oct 2016 00:24:43 +0200
- Subject: Re: x86/64 alignment, optimization, -Wcast-align
- Authentication-results: sourceware.org; auth=none
- References: <CA+1z_s_3-urv_NQY7amyvdApFLTJ2Y5e8_ub=+LmN=oL7+y4YQ@mail.gmail.com> <CA+1z_s9XeeCW5mJzeiX7ksTnZFsNzUpS2XK8xquYEw10WX1K5w@mail.gmail.com> <CAH8yC8=KPLZR3RwvZteMZQD-2=y4i+Q=PCMJDbML=rNNnnK7Dw@mail.gmail.com>
I don't allocate the memory, I write a DLL and memory is handed to me
as a byte array.
2016-10-26 0:10 GMT+02:00 Jeffrey Walton <noloader@gmail.com>:
> On Tue, Oct 25, 2016 at 5:58 PM, Balázs Oroszi <orobalage@gmail.com> wrote:
> Usually, you go the other way: you either (1) align to 16 for stack
> based allocations, or (2) allocate on the heap, which has 16-byte
> alignment. It allows you the benefit of vectorization and AVX.
>
> You also have to avoid the unaligned data accesses and type punning.
> The undefined behavior sanitizers are usually very good about finding
> them at runtime. Just compile with -fsanitize=undefined, and then run
> your test suite.
>
> Jeff