[Bug c/16660] New: attribute((aligned)) doesn't work for variables on the stack

jens dot maurer at gmx dot net gcc-bugzilla@gcc.gnu.org
Wed Jul 21 20:43:00 GMT 2004


Running the program below compiled with "-mpreferred-stack-boundary=2"
gets a "segmentation fault" because the variable "tmp"
is not properly aligned on a 16-byte boundary (required for
movaps), violating the aligned(16) request in the attribute.

void f()
{
  unsigned long tmp[4] __attribute__((aligned(16)));
  asm("movaps %%xmm0, (%0)" : : "r" (tmp) : "memory");
}

int main()
{
  f();
}

-- 
           Summary: attribute((aligned)) doesn't work for variables on the
                    stack
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jens dot maurer at gmx dot net
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16660



More information about the Gcc-bugs mailing list