https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61421
--- Comment #7 from mimamer at gmail dot com --- Violation of aliasing or not, the problem arises prior to the downcasting from list2<T>::node* to T*: T *head = anchor.next; anchor.next = head->next; head->next->prev = (T *)&anchor; // where did head->next become NULL??? where anchor is defined as struct node { T *next; T *prev; } anchor; I don't see actually why this should be invalid under any (retarded) aliasing rules. If Andrew or any of the other experts here could point out to me how the problem can be solved _without_ fundamentally changing the implementation of list2 (such as specifying anchor as of type T) I would be very grateful. Thanks a LOT in advance! Also, again, why does -fno-strict-aliasing (placed _after_ -O2) not have any effect?