Sujet : Re: Cost of handling misaligned access
De : already5chosen (at) *nospam* yahoo.com (Michael S)
Groupes : comp.archDate : 10. Feb 2025, 11:23:52
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20250210122352.000050fc@yahoo.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
User-Agent : Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-w64-mingw32)
On Sat, 08 Feb 2025 08:11:04 GMT
anton@mips.complang.tuwien.ac.at (Anton Ertl) wrote:
keylocks3.c compiles without warning on clang, but the result usually
segfaults (but sometime does not, e.g., in the timed run on Zen4; it
segfaults in other runs on Zen4). I have not investigated why this
happens, I just did not include results from runs where it segfaulted;
and I tried additional runs for keylocks3-512 on Zen4 in order to have
one result there.
I got random crashes both on keylocks3.c and on keylocks4.c.
My test bench includes testing of 1024 combinations of key and lock
lengths, so it likely catches some problematic cases in keylocks4.c.
that you overlooked.
The fix appears to be addition of alignment requirement for locks1[].
_Alignas(UNROLL*4) int locks1[nlocks1];
Cleaner solution is to declare locks1[] as
vu locks1[nlocks1/UNROLL];
But I wanted to modify your code as little as possible.