Johannes Schindelin wrote:
In this discussion, you write repeatedly about the alignment of the
variable, you even propose a comment to that effect.
Note, this is not about the alignment, it is about aliasing, which means
two different pointers may access the same memory location.
When compiling xz_dec_stream.c with GCC 7.1.0, it complains thusly:
In function 'dec_stream_footer':
error: dereferencing type-punned pointer will break strict-aliasing
if (xz_crc32(s->temp.buf + 4, 6, 0) != get_le32(s->temp.buf))
The thing is, the `buf` field was put just after two fields of type
size_t for the express purpose of avoiding alignment issues, as per the
comment above the `temp` struct.
+ * The temp.buf field is put just after two fields of type size_t for
+ * the express purpose of avoiding alignment issues. But GCC complains
+ * about it nevertheless... so: shut GCC up for a few lines.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wstrict-aliasing"
busybox mailing list