http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56221
Bug #: 56221 Summary: Generation of zero initializer for array new without parenthesis Classification: Unclassified Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: neldev.onl...@gmail.com Created attachment 29364 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29364 Minimal test case I could not find a duplicate so I guess this will be my first bug report for a compiler :) I was experimenting a little with expressive templates and stumbled upon a peculiar bug that caused assembly output to explode by several orders of magnitude. I managed to narrow it down to automatic vectorization of a zero initializer that transformed a 4-instruction memset into some monstrosity. Recompiling with -fno-tree-vectorize prevents this transformation. However, the issue of this initializer which generated the memset still remained. I've attached a minimal test case that performs the following: - Trigger unwanted generation of the array initializer. - Triggering automatic vectorization at will by increasing the parameter to array new beyond 16. - Preventing the array initializer from being generated by uncommenting the second constructor. - Producing identical results by forcing array initializer generation by uncommenting the third constructor. A workaround would b to move the array new statement out of the constructor. I'm not sure but this seems to be the result of some foul play between the CRTP pattern and operator+. Removing either will prevent this bug from being triggered.