Nikos Mavrogiannopoulos nmav@gnutls.org writes:
I couldn't deduce that from your description. Why are these reads legal?
Because they are read at a word aligned address.
Irrespective of the C standard, why do you think that accessing this byte outside the buffer boundary is valid? I guess you rely that pages will be of an aligned size anyway?
I expect that every byte of memory which is accessible at all is accessible using an aligned read access of a full word. I view byte-sized loads in the instruction set as mostly syntactic sugar for word-sized loads and masking.
If you are aware of any problems on real systems (say, using memxor with some memory mapped i/o register area as a source), I'd like to hear the details.
I see no problem with the x86_64 assembly code. Maybe it's a problem with the supposedly portable C implementation. There's also other code depending on endianness (and WORDS_BIGENDIAN), which strictly speaking is not valid C. But I don't intend to fix such things unless it breaks things on some otherwise supported platform.
If needed, we can add a configure test and a simple and 100% kosher byte-by-byte memxor loop for affected systems.
Regards, /Niels