This fixes PR48493 by backporting a one-liner - we should not go the movmisalign path for destinations that are not memory.
Bootstrapped and tested on x86_64-unknown-linux-gnu and on mips by Andrew, installed. Richard. 2012-05-31 Richard Guenther <rguent...@suse.de> PR middle-end/48493 * expr.c (expand_assignment): Do not use movmisalign on non-memory. * gcc.dg/torture/pr48493.c: New testcase. Index: gcc/expr.c =================================================================== *** gcc/expr.c (revision 188009) --- gcc/expr.c (working copy) *************** expand_assignment (tree to, tree from, b *** 4593,4598 **** --- 4593,4599 ---- if ((TREE_CODE (to) == MEM_REF || TREE_CODE (to) == TARGET_MEM_REF) && mode != BLKmode + && !mem_ref_refers_to_non_mem_p (to) && ((align = get_object_or_type_alignment (to)) < GET_MODE_ALIGNMENT (mode)) && ((icode = optab_handler (movmisalign_optab, mode)) Index: gcc/testsuite/gcc.dg/torture/pr48493.c =================================================================== *** gcc/testsuite/gcc.dg/torture/pr48493.c (revision 0) --- gcc/testsuite/gcc.dg/torture/pr48493.c (revision 0) *************** *** 0 **** --- 1,18 ---- + /* { dg-do compile } */ + + typedef long long T __attribute__((may_alias, aligned (1))); + + struct S + { + _Complex float d __attribute__((aligned (8))); + }; + + void bar (struct S); + + void + f1 (T x) + { + struct S s; + *(T *) ((char *) &s.d + 1) = x; + bar (s); + }