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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
That is because a[i] is *(a + i) according to the C standard and
a + i yiels a pointer of type aligned_double which immediately invokes UB.

There's no way to do what you want in standard C.  In GNU C do

void add(double* a, double* b, double* c, int end, int start)
{
  a = __builtin_assume_aligned (a, 32);
  b = ...
  c = ...
    for (decltype(end) i = start; i < end; ++i)
        c[i] = a[i] + b[i];
}

Reply via email to