https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86555
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED CC| |rguenth at gcc dot gnu.org Resolution|--- |INVALID --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- If dirent has alignof() == 8 then you have to make sure de is properly aligned inside buf[]. I assume off_t is 8 bytes. The issue might be that buf[] itself is only 4 byte aligned when you use lock[1] instead of lock[2]. You can do volatile int lock[1]; /* was 2, with 1 we get ldrd unalignment */ char buf[2048] __attribute__((aligned(8))); }; to get 8-byte alignment for buf (or add a int pad; member)