https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61292
Bug ID: 61292 Summary: auto keyword to vector reference generates wrong alignment move Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: vincenzo.innocente at cern dot ch given typedef float __attribute__( ( vector_size( 16 ) ) ) float32x4_t; typedef float __attribute__( ( vector_size( 16 ) , aligned(4) ) ) float32x4a4_t; void add11(float * x, float y, float32x4_t v) { auto & k1 = *(float32x4a4_t*)(x); auto & k2 = *(float32x4a4_t*)(x); k1 +=v; k2 += k1+v; } void add98(float * x, float y, float32x4_t v) { float32x4a4_t & k1 = *(float32x4a4_t*)(x); float32x4a4_t & k2 = *(float32x4a4_t*)(x); k1 +=v; k2 += k1+v; } I get c++ -std=c++1y -Ofast -march=haswell -S extNotAlign.cc; cat extNotAlign.s __Z5add11PffU8__vectorf: LFB4: vaddps (%rdi), %xmm1, %xmm0 vaddps %xmm0, %xmm0, %xmm0 vaddps %xmm1, %xmm0, %xmm1 vmovaps %xmm1, (%rdi) ret LFE4: .section __TEXT,__text_cold,regular,pure_instructions LCOLDE4: .text LHOTE4: .section __TEXT,__text_cold,regular,pure_instructions LCOLDB5: .text LHOTB5: .align 4,0x90 .globl __Z5add98PffU8__vectorf __Z5add98PffU8__vectorf: LFB5: vaddps (%rdi), %xmm1, %xmm0 vaddps %xmm0, %xmm0, %xmm0 vaddps %xmm1, %xmm0, %xmm1 vmovups %xmm1, (%rdi) ret second of course is correct (vmovups not vmovaps)