I’m working on updating Valgrind for FreeBSD 13.1 (I’m the maintainer, and FreeBSD 13.1 was officially released today).
One of the problems that I see is with the testcase none/tests/amd64/amd64locked
Here’s a link to the source
The problem is not related to Valgrind. If I run the executable alone it fails
$ ./amd64locked
amd64locked: FAIL: CRCs actual 0xA248D739 expected 0xDF0656F1
amd64locked: set #define VERBOSE 1 to diagnose
This is on FreeBSD 13.1 RC6 amd64 running on VirtualBox, compiler version
FreeBSD clang version 13.0.0 (git@github.com:llvm/llvm-project.git llvmorg-13.0.0-0-gd7b669b3a303)
I’m not familiar with the code. It’s a long test for all amd64 instructions with a lock prefix performing CRC calculations. Compiled without optimization it passes
The source contains this comment
// So there should be 118 lock-prefixed instructions in the
// disassembly of this compilation unit.
// confirm with
// objdump -d ./amd64locked | grep lock | grep -v do_lock | grep -v elf64 | wc
This also gives the wrong output.
$ objdump -d ./amd64locked | grep lock | grep -v do_lock | grep -v elf64 | wc
136 1193 7376
I’ll see if I can reproduce the failure on Linux (Fedora 34). I’ll also look at the assembler to see if I can at least get an idea of what has changed. I can also probably try a more recent llvm on FreeBSD.
UPDATE:
I need to redo my tests on Linux to make sure I’m compiling with -g -O
Higher optimization seems more problematic.
The code goes generate quite a few warnings with -Weverything: inplicit int and sign conversions, superfluous semicolons, and shortening.
Can anyone help with this?