https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71644
Bug ID: 71644 Summary: gcc 6.1 generates movaps for unaligned memory Product: gcc Version: 6.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: justus at gmx dot li Target Milestone: --- Created attachment 38757 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38757&action=edit code for reproduction compiling the code below using gcc 6.1.0 (on a x86_64 linux machine) or a current svn snapshot genereates the expected two versions of Derived::Derived. the problem is that in both the complete object constructor and the base object construct 'movaps' is used to write both Derived::m2 and Derived::m3 at once, but if Derived is the base of TestBug then Derived::m2 is not 16byte aligned anymore. this results in a segfault. -- gcc command g++ -save-temps -Wall -Wextra -std=c++14 -ggdb -O3 -o /tmp/testbug /tmp/testbug.cc -- code -- #include <cstdint> struct Base { alignas(16) int64_t mAligned=0; }; struct Derived : public virtual Base { public: int64_t m1; int64_t m2{ 1234 }; int64_t m3{ 2345 }; __attribute__ ((noinline)) // or put ctor into different compilation unit Derived(){} }; struct TestBug : public virtual Derived {}; int main() { Derived derived; // good TestBug testbug; // crashes because of using movaps on unaligned memory }