On Fri, 7 Feb 2014, Andreas Krebbel wrote: > Hi, > > on S/390 128 bit atomic operations are not allowed for misaligned > operands. The expanders are supposed to FAIL in that case. While it > works for the other routines atomic_load/store it does not work > currently during compare and swap expansion. > > The patch just turns an expand_insn into maybe_expand_insn to allow > other alternatives to be chosen when the expander fails.
I expect this is correct for cases when a misaligned operand gets through that the front end thought was aligned - I doubt it's possible to avoid all such cases where misalignment only becomes visible here. But it also suggests there may well be problems in other places. In particular: * c-common.c:resolve_overloaded_atomic_* may need to check if the alignment is sufficient and generate library calls if not. (This would need to be conservative about alignment, like C11 _Alignof, for cases such as x86 long long in structures; see <http://gcc.gnu.org/ml/gcc-patches/2013-11/msg02862.html>.) * It's possible your target should also increase alignment of relevant types when _Atomic-qualified. (But increasing to an alignment greater than is returned by malloc may not be a good idea.) -- Joseph S. Myers jos...@codesourcery.com