https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83396
--- Comment #67 from ktkachov at gcc dot gnu.org --- Thanks for working on this! As of r255632 I'm still getting: Error: unaligned opcodes detected in executable segment on arm targets when building gdb. A reduced testcase is: ------------------------------------------------------ template <typename T> void xfree(T); enum target_waitkind { TARGET_WAITKIND_SIGNALLED, TARGET_WAITKIND_LOADED, TARGET_WAITKIND_EXECD, TARGET_WAITKIND_SYSCALL_RETURN, TARGET_WAITKIND_SPURIOUS }; class target_terminal { public: static void m_fn1(); } a; target_waitkind b; void startup_inferior() { switch (b) { case TARGET_WAITKIND_SPURIOUS: case TARGET_WAITKIND_LOADED: case TARGET_WAITKIND_SIGNALLED: TARGET_WAITKIND_EXITED: target_terminal::m_fn1(); case TARGET_WAITKIND_EXECD: xfree(a); } } -------------------------------------------- The error can be reproduced with: arm-none-eabi-g++ -O2 -g -c