Created attachment 923877 [details] sha512.i The sha512t test fails when openssl is compiled with gcc-4.9.1-2.fc21.1.s390 with -O2, while -O1 and -O0 work correctly. I have tracked the problem down to function sha512_block_data_order from file crypto/sha/sha512.c. Prefixing the function with __attribute__((optimize (0))) fixes the problem. __attribute__((noinline,noclone)) does not help - the test is still failing. The program does not crash, it just calculates a wrong result. Attaching the preprocessed source.
Can you turn this into a self-contained testcase? I.e. create a short main that will populate the SHA512_CTX with some values that show the miscompilation, point it to unsigned long long array filled, call sha512_block_data_order with those arguments and after calling it e.g. compare SHA512_CTX content if it is the expected one? Thanks.
Now tracked upstream as PR62025.