Bug in sha512 digest with -march=native -mtune=native -m64

Peter Gutmann pgut001 at cs.auckland.ac.nz
Thu Jun 20 07:48:47 CEST 2013


David Shaw <dshaw at jabberwocky.com> writes:

>I've seen something like this once before.  That one turned out to be a
>compiler issue with -O greater than 2, coincidentally also breaking the
>hashing code (it was TIGER if I recall).  I'm not saying your problem is a
>compiler issue, but out of curiosity, what happens if you compile with -O2 ?

I've found so many optimiser bugs in gcc across different platforms with -O3 
(and wasted so much time staring at -S output that bore no resemablance to the 
original C code) that I switched to -O2 by default in my code.  I don't think 
I've had any problems since.  You don't lose much -O with -O2 (and in 
particular in gcc 4.x they made changes that produce far larger binaries than 
-O2, with ensuing poor cache localisation properties), so the switch to -O2 
was pretty easy and solved a lot of headaches.

Peter.




More information about the Gnupg-devel mailing list