http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57748
--- Comment #10 from Martin Jambor <jamborm at gcc dot gnu.org> ---
The problem is that the type of the record that contains the scalar
data we are accessing has non-BLK mode despite that we are not
accessing a part of it. This is because it has a zero sized trailing
array:
typedef struct S { V a; V b[0]; } P __attribute__((aligned (1)));
in the x86_64-linux example from comment #9, and
struct resolved_chain {
u64 nr;
struct resolved_ip ips[0];
};
in the original testcase.
Because it has non-BLK mode, it passes the condition in
expand-assignment that is there to handle accesses to small,
scalar-sized structures (or even arrays) which should be written to
memory through movmisalign_optab. E.g. to access an element of a
vector.
However, in these testcases, the structure we are writing to is bigger
than a scalar. I wonder why structures with trailing zero-sized
arrays have non-BLK mode. I think that is the root of the problem,
actually.