Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
v01dXYZ opened this issue May 31, 2024 · 2 comments
Open

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

v01dXYZ opened this issue May 31, 2024 · 2 comments

Comments

@v01dXYZ
Copy link
Contributor

v01dXYZ commented May 31, 2024

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
Copy link
Contributor Author

v01dXYZ commented Jun 1, 2024

I suspect the cause israndom in initialize_solver.

@v01dXYZ
Copy link
Contributor Author

v01dXYZ commented Jun 1, 2024

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

v01dXYZ pushed a commit to v01dXYZ/llvm-test-suite that referenced this issue Jun 4, 2024
musl implements random() differently than glibc.

The output of the program is thus dependent on this implementation
detail and could differ between platforms. To remediate that, we
replace it by a very simple PRNG (ANSI C LCG).

Warning: [1] indicates this PRNG have quite a poor LSB randomness.

[1]: Entacher, Karl. (1999). A Collection of Selected Pseudorandom
Number Generators With Linear Structures.

Fixes llvm/llvm-project#94048
v01dXYZ pushed a commit to v01dXYZ/llvm-test-suite that referenced this issue Jun 4, 2024
musl implements random() differently than glibc.

The output of the program is thus dependent on this implementation
detail and could differ between platforms. To remediate that, we
replace it by a very simple PRNG (ANSI C LCG).

Warning: [^1] indicates this PRNG have quite a poor LSB randomness.

[^1]: Entacher, Karl. (1999). A Collection of Selected Pseudorandom
Number Generators With Linear Structures.

Fixes llvm/llvm-project#94048
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant