llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.89k stars 11.93k forks source link

[test-suite] obsequi output is different on musl platform #94048

Open v01dXYZ opened 5 months ago

v01dXYZ commented 5 months ago

When compiling obsequi with

 cc *.c -o obsequi -DCOUNTBITS16 -DLASTBIT16 -DCOUNTMOVES_TABLE  -DTWO_STAGE_GENERATION  -DHASHCODEBITS=23 -Wno-implicit-int 

To generate the output from the test input:

cat input | ./obsequi

The output is different between debian (glibc) (same as Obsequi.reference_output) and alpine (musl) (both with clang 16 and 17).

$ cat /etc/alpine-release
3.20.0
$ clang --version
Alpine clang version 17.0.6
Target: x86_64-alpine-linux-musl
Thread model: posix
InstalledDir: /usr/bin
Configuration file: /etc/clang17/x86_64-alpine-linux-musl.cfg
$ clang-16 --version
Alpine clang version 16.0.6
Target: x86_64-alpine-linux-musl
Thread model: posix
InstalledDir: /usr/bin
Configuration file: /etc/clang16/x86_64-alpine-linux-musl.cfg
root@12754302fc9c:/# cat /etc/debian_version
trixie/sid
root@12754302fc9c:/# clang --version
Debian clang version 16.0.6 (27)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
v01dXYZ commented 5 months ago

I suspect the cause israndom in initialize_solver.

v01dXYZ commented 5 months ago

I confirm replacing random() by a Linear Congruential Generator solves the issue.