https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68467
--- Comment #6 from Jeffrey A. Law <law at redhat dot com> --- This is a bad interaction between PREFERRED_STACK_BOUNDARY and PUSH_ROUNDING, but there's a deeper code generation issue that needs to be looked at as well. So background. A push insn on the m68k is actually a store using a pre-decrement addressing mode and register a7. ie -(%a7) aka -(%sp) The original m68k family special cased byte pushes so that if you did something like mov.b <input>,-(%sp) You would actually push 2 bytes on the stack instead of 1 to ensure the stack was always 2 byte aligned. This quirk was only done when using sp/a7 in predec/postinc addressing modes as push/pop insns. The coldfire family did away with that quirk and no longer special cases sp/a7 in those addressing modes. GCC uses PUSH_ROUNDING to describe the behavior of the original m68k family. As expected it's behavior is now conditional on TARGET_COLDFIRE: /* On the 680x0, sp@- in a byte insn really pushes a word. On the ColdFire, sp@- in a byte insn pushes just a byte. */ #define PUSH_ROUNDING(BYTES) (TARGET_COLDFIRE ? BYTES : ((BYTES) + 1) & ~1) Another quirk of the Coldfire family is that it really prefers its stack stack 32 bit aligned. It impacts all kinds of things. So not surprisingly m68k has (m68k.h and linux.h respectively): /* ColdFire and fido strongly prefer a 32-bit aligned stack. */ #define PREFERRED_STACK_BOUNDARY \ ((TARGET_COLDFIRE || TARGET_FIDOA) ? 32 : 16) #undef PREFERRED_STACK_BOUNDARY #define PREFERRED_STACK_BOUNDARY 32 So far, so good on the target bits. We define various sync builtins, including: DEF_SYNC_BUILTIN (BUILT_IN_SYNC_VAL_COMPARE_AND_SWAP_1, "__sync_val_compare_and_swap_1", BT_FN_I1_VPTR_I1_I1, ATTR_NOTHROWCALL_LEAF_LIST) ie, char __sync_val_compare_and_swap_1 (void *, char, char) These are called as libcalls, not normal functions. This distinction is important. So when we make a call to __sync_val_compare_and_swap, on coldfire we push 6 bytes of data. This then runs afoul of this assert in emit_library_call_value_1: /* Stack must be properly aligned now. */ gcc_assert (!(stack_pointer_delta & (PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT - 1))); (STACK_POINTER_DELTA will be 6). But wait, it's actually worse. While the caller seems to want to push bytes, the callee seems to be using a more standard ABI where the usual promotions occur. ie, expects the caller to have pushed 32bit words. So not only do we have the assertion to deal with, we really need to address the ABI mismatch. What a mess. There's a reasonable chance I will not get this addressed prior to gcc-7. m68k just isn't that high a priority.