https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103303
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- #include <iostream> #include <cstddef> struct alignas(16) largeAligned{ // change to 8, no crash uint32_t u_arr[128]; }; template<typename Base> struct ICategory: public virtual Base{ ICategory(){ std::cout << __PRETTY_FUNCTION__ << std::endl; } }; struct PureInterfaceHandler{ virtual ~PureInterfaceHandler() = default; }; template<typename...MsgCategoryNotifierS> class TemplateNotifier : public PureInterfaceHandler, public MsgCategoryNotifierS...{ public: TemplateNotifier() { std::cout << __PRETTY_FUNCTION__ << std::endl; } virtual ~TemplateNotifier() { std::uintptr_t t = (std::uintptr_t)this; printf("this:%lx\n", (long)(t&0xff)); printf("this->PureInterfaceHandler:%lx\n", (long)((std::uintptr_t)(PureInterfaceHandler*)this&0xff)); (printf("this->%s:%lx\n", typeid (MsgCategoryNotifierS).name(),(long)((std::uintptr_t)(MsgCategoryNotifierS*)this&0xff)),...); std::cout << __PRETTY_FUNCTION__ << std::endl; } }; struct Base1{ Base1(){ std::cout << __PRETTY_FUNCTION__ << std::endl; std::uintptr_t t = (std::uintptr_t)&aligned1; printf("%lx\n", (long)(t&0xff)); } virtual ~Base1(){ std::uintptr_t t = (std::uintptr_t)&aligned1; printf("%lx\n", (long)(t&0xff)); std::cout << __PRETTY_FUNCTION__ << std::endl; } largeAligned aligned1; }; struct Base2{ Base2(){ std::cout << __PRETTY_FUNCTION__ << std::endl; std::uintptr_t t = (std::uintptr_t)&aligned2; printf("%lx\n", (long)(t&0xff)); } virtual ~Base2(){ std::uintptr_t t = (std::uintptr_t)&aligned2; printf("%lx\n", (long)(t&0xff)); std::cout << __PRETTY_FUNCTION__ << std::endl; } largeAligned aligned2; }; using Category2 = ICategory<Base1>; using Category1 = ICategory<Base2>; struct ProblematicNotifier: TemplateNotifier<Category1, Category2>{}; int main(){ static_assert(alignof(ProblematicNotifier) == 16, "128 is great" ); static_assert( alignof(std::max_align_t) == 16, "16? is great" ); ProblematicNotifier* objPtr = new ProblematicNotifier(); delete objPtr; std::cout << "Done" << std::endl; } Looks like there is some wrong alignment information feed to the rest of the compiler. this->9ICategoryI5Base2E:b8 this->9ICategoryI5Base1E:c0