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

            Bug ID: 65672
           Summary: type attribute "aligned" can decrease alignment
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Keywords: documentation
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: glisse at gcc dot gnu.org

https://gcc.gnu.org/onlinedocs/gcc/Type-Attributes.html states that 
"The aligned attribute can only increase the alignment"

However, on x86_64:

typedef float vec __attribute__((vector_size(16)));
typedef float vecu __attribute__((vector_size(16),aligned(8)));

alignof(vec) says 16 and alignof(vecu) says 8. And indeed,

vec f(vecu*p){
  return *p;
}

compiles to movups (while regular loads use movaps), so this behavior is
useful. Assuming it is meant to work and not just an accident, it would be nice
to document this (otherwise it is a wrong code bug).

Reply via email to