http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47273

--- Comment #8 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-01-14 
16:02:06 UTC ---
It works with

typedef int T __attribute__((aligned(1)));
struct s {
    T a;
    T& GetValr() { return a; }
} __attribute__((packed));


int main() {
    struct s s1;

    s1.GetValr() = 5;
}

so it's probably to guard you against crashes on targets that do
not support unaligned accesses (*(int&) is aligned but s1.b is not).
Note that the above will still not do what is necessary for such
targets.

The pointer case is probably supported for legacy reasons.

Reply via email to