-
Notifications
You must be signed in to change notification settings - Fork 38.6k
guix: use GCC 14.3.0 over 13.3.0 #33775
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
base: master
Are you sure you want to change the base?
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/33775. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
|
Concept ACK. |
maflcko
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
concept ack. 14.3 should be sufficiently propagated and tested by now, to rely on it for release builds
|
lgtm ACK 25ede96 |
|
Guix Build (x86_64): 6c31a0f19daec94c3d629e50d6bc2461ceb6e0fbb0823cb10a40bc735e37f9b5 guix-build-25ede968bada/output/aarch64-linux-gnu/SHA256SUMS.part
f3ba2f0c5f1d99d377ea11ea2b9983187192d733c7db444060d112d1be48ecd2 guix-build-25ede968bada/output/aarch64-linux-gnu/bitcoin-25ede968bada-aarch64-linux-gnu-debug.tar.gz
321db43f3a4327287813274b7f9874fb76799643fdc9cbbc9ee13bce10b6e004 guix-build-25ede968bada/output/aarch64-linux-gnu/bitcoin-25ede968bada-aarch64-linux-gnu.tar.gz
58f449098f98b7746c2ba9286a3582852aed3c32b3cc0327598c279d46eab5b7 guix-build-25ede968bada/output/arm-linux-gnueabihf/SHA256SUMS.part
0c51f7872d5f65ad2bd432d20f76c49b8e2dc765cacb53f696b0a0c5ea91b56b guix-build-25ede968bada/output/arm-linux-gnueabihf/bitcoin-25ede968bada-arm-linux-gnueabihf-debug.tar.gz
4f679e6074c745b2e91494721a6c8aa0ef24e19f18a3971ac53913441fdbf399 guix-build-25ede968bada/output/arm-linux-gnueabihf/bitcoin-25ede968bada-arm-linux-gnueabihf.tar.gz
8a66a9d3180f8fa386a0fdfc4ed1b80c716ec9b754921c35543cdc822ea35bf9 guix-build-25ede968bada/output/arm64-apple-darwin/SHA256SUMS.part
cbbffbb237ca4a0174f457824a21412334d7ce7c1931c78fe293520029e97c32 guix-build-25ede968bada/output/arm64-apple-darwin/bitcoin-25ede968bada-arm64-apple-darwin-codesigning.tar.gz
518312fec80b309a38393a7408cad0fda28f4cf7b52d08a5b4c2d1a26ea9b8d4 guix-build-25ede968bada/output/arm64-apple-darwin/bitcoin-25ede968bada-arm64-apple-darwin-unsigned.tar.gz
5a36a5ddea0070e3efd6e3db92528705483a2dd4ebc9287ed42c3d180537092a guix-build-25ede968bada/output/arm64-apple-darwin/bitcoin-25ede968bada-arm64-apple-darwin-unsigned.zip
768446c9e4037d07b76df5379ff42482e2ce264db5e0ed61694af0c7ea49cd69 guix-build-25ede968bada/output/dist-archive/bitcoin-25ede968bada.tar.gz
a85baf46acec900f79b9343f9bd918731bfc0f1fea7586b902f28e99cda59e37 guix-build-25ede968bada/output/powerpc64-linux-gnu/SHA256SUMS.part
c01ac68acbdae911b56a6b3eb1762d9f57d4d7fc0dbedfa3f4c0905bf4be6853 guix-build-25ede968bada/output/powerpc64-linux-gnu/bitcoin-25ede968bada-powerpc64-linux-gnu-debug.tar.gz
f08b8d0909eb6f6a7f4b483f338655b0c44ee85c219360b62c99165df5aed157 guix-build-25ede968bada/output/powerpc64-linux-gnu/bitcoin-25ede968bada-powerpc64-linux-gnu.tar.gz
a2e1c4960965d6315e3c89579b7224970229d01f1c9b60ff8ec1698a1bebb884 guix-build-25ede968bada/output/riscv64-linux-gnu/SHA256SUMS.part
6b4958341f9648ddaf7c57a788db7b229d6be4cc7f9548f3acd84c2ce990909a guix-build-25ede968bada/output/riscv64-linux-gnu/bitcoin-25ede968bada-riscv64-linux-gnu-debug.tar.gz
2f03dcd2941388cecb4c7ae1d8e0b925e0bcc1c0f79f6676906b88ed3f98c1e0 guix-build-25ede968bada/output/riscv64-linux-gnu/bitcoin-25ede968bada-riscv64-linux-gnu.tar.gz
a8b021adae39e2f9beaa37e6fa370eaa6fac033505cdfe8fdfcb01f6b6786ce1 guix-build-25ede968bada/output/x86_64-apple-darwin/SHA256SUMS.part
10cd32f7b51cca2473d4c1a92cde51914ec36e5d90d46c623047b0bd4a6171ce guix-build-25ede968bada/output/x86_64-apple-darwin/bitcoin-25ede968bada-x86_64-apple-darwin-codesigning.tar.gz
dfde14c907e39b547681600cf0a1056f88d4e26d67bda66bb0ebdacaa77755bb guix-build-25ede968bada/output/x86_64-apple-darwin/bitcoin-25ede968bada-x86_64-apple-darwin-unsigned.tar.gz
3a69e45b82a8397d4638ca3cf08d436f7fffa3ebab4a664ae5785b0e02726ed5 guix-build-25ede968bada/output/x86_64-apple-darwin/bitcoin-25ede968bada-x86_64-apple-darwin-unsigned.zip
f490dc45e3401815c252e4f818d266a6076e225e17f8a83a64d0919f2ca419fd guix-build-25ede968bada/output/x86_64-linux-gnu/SHA256SUMS.part
de096f32dd1396195723db299ae8f299f9a8a425f45a79f9414184b4ec98c252 guix-build-25ede968bada/output/x86_64-linux-gnu/bitcoin-25ede968bada-x86_64-linux-gnu-debug.tar.gz
1f035fbdcda7e22390b4dc89dfc765f98a01f95d3f39faf8a34be51c6dd4bb9f guix-build-25ede968bada/output/x86_64-linux-gnu/bitcoin-25ede968bada-x86_64-linux-gnu.tar.gz
50437f34b662a2cf0dc55c6d54b8a74b19d5fcc02380490e1a5a6347a4c2520c guix-build-25ede968bada/output/x86_64-w64-mingw32/SHA256SUMS.part
780df1f42e33f6d5203b818bc0081c7a420878de274295cebb4668f54653a735 guix-build-25ede968bada/output/x86_64-w64-mingw32/bitcoin-25ede968bada-win64-codesigning.tar.gz
8eec58e81a5a3f072c8ba2ec39cde884f725e0ce3a295dd8f0b37710c0874682 guix-build-25ede968bada/output/x86_64-w64-mingw32/bitcoin-25ede968bada-win64-debug.zip
b7d9273ef4d2edf723442bedc570af20efa218afcd7cc85cfd66be065c3f6e58 guix-build-25ede968bada/output/x86_64-w64-mingw32/bitcoin-25ede968bada-win64-setup-unsigned.exe
68a88570939913939f411cfd11e0f0d3260970c4767490b227d94a417f9a55db guix-build-25ede968bada/output/x86_64-w64-mingw32/bitcoin-25ede968bada-win64-unsigned.zip |
|
|
Windows is non-deterministic across x86_64 && aarch64. 6c31a0f19daec94c3d629e50d6bc2461ceb6e0fbb0823cb10a40bc735e37f9b5 guix-build-25ede968bada/output/aarch64-linux-gnu/SHA256SUMS.part
f3ba2f0c5f1d99d377ea11ea2b9983187192d733c7db444060d112d1be48ecd2 guix-build-25ede968bada/output/aarch64-linux-gnu/bitcoin-25ede968bada-aarch64-linux-gnu-debug.tar.gz
321db43f3a4327287813274b7f9874fb76799643fdc9cbbc9ee13bce10b6e004 guix-build-25ede968bada/output/aarch64-linux-gnu/bitcoin-25ede968bada-aarch64-linux-gnu.tar.gz
58f449098f98b7746c2ba9286a3582852aed3c32b3cc0327598c279d46eab5b7 guix-build-25ede968bada/output/arm-linux-gnueabihf/SHA256SUMS.part
0c51f7872d5f65ad2bd432d20f76c49b8e2dc765cacb53f696b0a0c5ea91b56b guix-build-25ede968bada/output/arm-linux-gnueabihf/bitcoin-25ede968bada-arm-linux-gnueabihf-debug.tar.gz
4f679e6074c745b2e91494721a6c8aa0ef24e19f18a3971ac53913441fdbf399 guix-build-25ede968bada/output/arm-linux-gnueabihf/bitcoin-25ede968bada-arm-linux-gnueabihf.tar.gz
8a66a9d3180f8fa386a0fdfc4ed1b80c716ec9b754921c35543cdc822ea35bf9 guix-build-25ede968bada/output/arm64-apple-darwin/SHA256SUMS.part
cbbffbb237ca4a0174f457824a21412334d7ce7c1931c78fe293520029e97c32 guix-build-25ede968bada/output/arm64-apple-darwin/bitcoin-25ede968bada-arm64-apple-darwin-codesigning.tar.gz
518312fec80b309a38393a7408cad0fda28f4cf7b52d08a5b4c2d1a26ea9b8d4 guix-build-25ede968bada/output/arm64-apple-darwin/bitcoin-25ede968bada-arm64-apple-darwin-unsigned.tar.gz
5a36a5ddea0070e3efd6e3db92528705483a2dd4ebc9287ed42c3d180537092a guix-build-25ede968bada/output/arm64-apple-darwin/bitcoin-25ede968bada-arm64-apple-darwin-unsigned.zip
768446c9e4037d07b76df5379ff42482e2ce264db5e0ed61694af0c7ea49cd69 guix-build-25ede968bada/output/dist-archive/bitcoin-25ede968bada.tar.gz
a85baf46acec900f79b9343f9bd918731bfc0f1fea7586b902f28e99cda59e37 guix-build-25ede968bada/output/powerpc64-linux-gnu/SHA256SUMS.part
c01ac68acbdae911b56a6b3eb1762d9f57d4d7fc0dbedfa3f4c0905bf4be6853 guix-build-25ede968bada/output/powerpc64-linux-gnu/bitcoin-25ede968bada-powerpc64-linux-gnu-debug.tar.gz
f08b8d0909eb6f6a7f4b483f338655b0c44ee85c219360b62c99165df5aed157 guix-build-25ede968bada/output/powerpc64-linux-gnu/bitcoin-25ede968bada-powerpc64-linux-gnu.tar.gz
a2e1c4960965d6315e3c89579b7224970229d01f1c9b60ff8ec1698a1bebb884 guix-build-25ede968bada/output/riscv64-linux-gnu/SHA256SUMS.part
6b4958341f9648ddaf7c57a788db7b229d6be4cc7f9548f3acd84c2ce990909a guix-build-25ede968bada/output/riscv64-linux-gnu/bitcoin-25ede968bada-riscv64-linux-gnu-debug.tar.gz
2f03dcd2941388cecb4c7ae1d8e0b925e0bcc1c0f79f6676906b88ed3f98c1e0 guix-build-25ede968bada/output/riscv64-linux-gnu/bitcoin-25ede968bada-riscv64-linux-gnu.tar.gz
a8b021adae39e2f9beaa37e6fa370eaa6fac033505cdfe8fdfcb01f6b6786ce1 guix-build-25ede968bada/output/x86_64-apple-darwin/SHA256SUMS.part
10cd32f7b51cca2473d4c1a92cde51914ec36e5d90d46c623047b0bd4a6171ce guix-build-25ede968bada/output/x86_64-apple-darwin/bitcoin-25ede968bada-x86_64-apple-darwin-codesigning.tar.gz
dfde14c907e39b547681600cf0a1056f88d4e26d67bda66bb0ebdacaa77755bb guix-build-25ede968bada/output/x86_64-apple-darwin/bitcoin-25ede968bada-x86_64-apple-darwin-unsigned.tar.gz
3a69e45b82a8397d4638ca3cf08d436f7fffa3ebab4a664ae5785b0e02726ed5 guix-build-25ede968bada/output/x86_64-apple-darwin/bitcoin-25ede968bada-x86_64-apple-darwin-unsigned.zip
f490dc45e3401815c252e4f818d266a6076e225e17f8a83a64d0919f2ca419fd guix-build-25ede968bada/output/x86_64-linux-gnu/SHA256SUMS.part
de096f32dd1396195723db299ae8f299f9a8a425f45a79f9414184b4ec98c252 guix-build-25ede968bada/output/x86_64-linux-gnu/bitcoin-25ede968bada-x86_64-linux-gnu-debug.tar.gz
1f035fbdcda7e22390b4dc89dfc765f98a01f95d3f39faf8a34be51c6dd4bb9f guix-build-25ede968bada/output/x86_64-linux-gnu/bitcoin-25ede968bada-x86_64-linux-gnu.tar.gz
a290a73521d2c2e39a72fe370a41c54d1e154dd96f9d7f9573c8fc2bf9a467ac guix-build-25ede968bada/output/x86_64-w64-mingw32/SHA256SUMS.part
86dd7a5f478f2878c3e6e6521395e06cc084ed60e56b99caa51abbac6dffa20c guix-build-25ede968bada/output/x86_64-w64-mingw32/bitcoin-25ede968bada-win64-codesigning.tar.gz
8eec58e81a5a3f072c8ba2ec39cde884f725e0ce3a295dd8f0b37710c0874682 guix-build-25ede968bada/output/x86_64-w64-mingw32/bitcoin-25ede968bada-win64-debug.zip
63069bfc67f7560b5503a355b3f8e3bd4584c41292c37aa7aa88126a87e8463a guix-build-25ede968bada/output/x86_64-w64-mingw32/bitcoin-25ede968bada-win64-setup-unsigned.exe
7417cb50480fd5006fb8d9e47e4564929398f62860f6829930abd978ca32505b guix-build-25ede968bada/output/x86_64-w64-mingw32/bitcoin-25ede968bada-win64-unsigned.zip |
Guix builds (on x86_64) [untrusted test-only build, possibly unsafe, not for production use] |
13bc295 to
24c7800
Compare
24c7800 to
4201f5d
Compare
4201f5d to
758da5a
Compare
|
I get a guix build failure @ 758da5a: |
758da5a to
fc56443
Compare
IMO this is safer. It removes only unreachable code, which is enough to remove the non-determinism. Reverting the optimization seems more risky especially for platforms where this is not needed. |
a72ff31 to
a797292
Compare
Nice reproduction branch. In theory this can be used directly to be put into guix-based creduce attempt#!/bin/bash
#
# Note: Currently not parallelism-safe. Start with: creduce --n 1 ./interestingness-test.sh foo.c
set -e
REMOTE1=ipv6::1 # guix aarch64
REMOTE2=ipv6::2 # guix amd64 x86_64
REMOTEPATH=/root/temp-creduce/test-original.i
REMOTEPATH_OBJ=/root/temp-creduce/test-original.cpp.obj
# overwrite the obj on compile failure, to mark it not interesting,
REMOTE_CMD="bash -c '( echo test-original.cpp.obj DUMMY && ( echo compile-failure-251a03efd96f46c3f93a9e0220edb86c > /root/temp-creduce/test-original.cpp.obj ) && cd ~/temp-creduce && FORCE_DIRTY_WORKTREE=1 V=1 VERBOSE=1 JOBS=1 ./contrib/guix/guix-build ) | grep test-original.cpp.obj'"
# Copy the file under test (C-Reduce provides it as ./foo.c, or whatever name you passed)
scp -i ~/.ssh/id_hetz ./foo.c "root@[$REMOTE1]:$REMOTEPATH" & P1=$!
scp -i ~/.ssh/id_hetz ./foo.c "root@[$REMOTE2]:$REMOTEPATH" & P2=$!
wait $P1
wait $P2
ssh -i ~/.ssh/id_hetz "root@$REMOTE1" "$REMOTE_CMD" > /tmp/hash1.$$ & P3=$!
ssh -i ~/.ssh/id_hetz "root@$REMOTE2" "$REMOTE_CMD" > /tmp/hash2.$$ & P4=$!
wait $P3
wait $P4
HASH1=$(</tmp/hash1.$$)
HASH2=$(</tmp/hash2.$$)
rm -f /tmp/hash1.$$ /tmp/hash2.$$
echo =====
echo $HASH1
echo $HASH2
echo =====
if [ "$HASH1" != "$HASH2" ]; then
# also store a recovery version in /tmp/, in case of an interrupt.
cp /root/temp-creduce/test-original.i /tmp/recovered
echo "NICE, the bug still reproduces!"
exit 0
else
echo "BAD, the bug is gone :("
exit 1
fiHowever, going through guix each time seems to add a delay, and the script isn't parallelism-safe, so can only be run via So I gave up after more than a week and wrote a new test.sh, which runs GCC directly on the Trixie hosts without guix: parallel creduce#!/bin/bash
#
# Start via creduce test.sh bar.cpp
set -e
REMOTE1=ipv6::3 # trixie aarch64
REMOTE2=ipv6::4 # trixie amd64 x86_64
PATH_EL="$$_$(date +%s%N)"
REMOTE_DIR=/root/scratch/$PATH_EL
REMOTEPATH=/root/scratch/$PATH_EL/input.cpp
REMOTEPATH_OBJ=/root/scratch/$PATH_EL/out.obj
# TODO the cleanup of the remote dir should be done with a context manager to
# clean up even after scp/ssh failures.. I guess i shouldn't write bash scripts
# and just use python or so.
# So for now, this will fill the storage while the script is running.
ssh -i ~/.ssh/id_hetz "root@$REMOTE1" "mkdir $REMOTE_DIR"
ssh -i ~/.ssh/id_hetz "root@$REMOTE2" "mkdir $REMOTE_DIR"
# overwrite the obj on compile failure, to mark it not interesting,
REMOTE_CMD="bash -c '( echo $REMOTEPATH_OBJ DUMMY && ( echo compile-failure > $REMOTEPATH_OBJ ) && cd /root/scratch && unset LIBRARY_PATH CPATH C_INCLUDE_PATH CPLUS_INCLUDE_PATH OBJC_INCLUDE_PATH OBJCPLUS_INCLUDE_PATH; x86_64-w64-mingw32-g++ -DNOMINMAX -DWIN32 -DWIN32_LEAN_AND_MEAN -D_MT -D_WIN32_IE=0x0A00 -D_WIN32_WINNT=0x0A00 -D_WINDOWS -Werror -O2 -g -fvisibility=hidden -fstack-reuse=none -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -std=c++20 -MD -save-temps -ffile-prefix-map=$REMOTE_DIR=. -o $REMOTEPATH_OBJ -c $REMOTEPATH && sha256sum $REMOTEPATH_OBJ ) | grep $REMOTEPATH_OBJ'"
# Copy the file under test (C-Reduce provides it as ./bar.cpp, or whatever name you passed)
scp -i ~/.ssh/id_hetz ./bar.cpp "root@[$REMOTE1]:$REMOTEPATH" & P1=$!
scp -i ~/.ssh/id_hetz ./bar.cpp "root@[$REMOTE2]:$REMOTEPATH" & P2=$!
wait $P1
wait $P2
ssh -i ~/.ssh/id_hetz "root@$REMOTE1" "$REMOTE_CMD" > /tmp/hash1.$PATH_EL & P3=$!
ssh -i ~/.ssh/id_hetz "root@$REMOTE2" "$REMOTE_CMD" > /tmp/hash2.$PATH_EL & P4=$!
wait $P3
wait $P4
HASH1=$(</tmp/hash1.$PATH_EL)
HASH2=$(</tmp/hash2.$PATH_EL)
rm -f /tmp/hash1.$PATH_EL /tmp/hash2.$PATH_EL
echo =====
echo $HASH1
echo $HASH2
echo =====
if [ "$HASH1" != "$HASH2" ]; then
# also store a recovery version in /tmp/, in case of an interrupt.
cp $REMOTEPATH /tmp/recovered
ssh -i ~/.ssh/id_hetz "root@$REMOTE1" "rm -r $REMOTE_DIR"
ssh -i ~/.ssh/id_hetz "root@$REMOTE2" "rm -r $REMOTE_DIR"
exit 0
else
ssh -i ~/.ssh/id_hetz "root@$REMOTE1" "rm -r $REMOTE_DIR"
ssh -i ~/.ssh/id_hetz "root@$REMOTE2" "rm -r $REMOTE_DIR"
exit 1
fiBasically the changes to the flags were adding So running via void b(void *h) {
void *c;
long f;
long b = __builtin_dynamic_object_size(h, 0);
__builtin___memcpy_chk(h, c, f, b);
}
class A {
public:
struct ay {
ay();
} az;
int ba[];
A(A &) { b(ba); }
};
class C {
A bq;
};
void *operator new(unsigned long long, void *j) { return j; }
int *n(void) {
long g;
return static_cast<int *>(operator new(g));
}
void bi(int *h, int *j) {
alignas(C) char temp_obj[sizeof(C)];
for (; h; j += sizeof(C)) {
new (reinterpret_cast<C *>(j)) C(*reinterpret_cast<C *>(temp_obj));
}
}
template <class k> void bm(int, int *j, k) {
int i;
bi(&i, j);
}
void a() {
int *d(n());
int r;
bm(r, d, 0);
}Not sure how to proceed from here. Though, it seems the GCC bug reproduces across all versions from 13, to 15: podman qemu GCC version reproduce matrixI didn't want to ssh into different boxes, to i just used the slow qemu for the different arches: #!/usr/bin/env bash
set -o errexit -o pipefail -o xtrace
ARCHS=("amd64" "arm64")
DISTROS=(
"ubuntu:24.04"
"ubuntu:26.04"
"debian:bookworm"
"debian:trixie"
"debian:forky"
)
OUTFILE="sha-output.txt"
: > "$OUTFILE"
for ARCH in "${ARCHS[@]}"; do
for DISTRO in "${DISTROS[@]}"; do
NAME="${DISTRO//:/-}-${ARCH}"
IMAGE="docker.io/library/${DISTRO}"
podman run --replace --detach --rm --platform "linux/${ARCH}" --name "$NAME" "$IMAGE" bash -c "sleep infinity"
podman cp ./bar.cpp "$NAME":/tmp/bar.cpp
podman exec "$NAME" bash -c "apt-get update -qq && apt-get install -y -qq g++-mingw-w64-x86-64"
RESULT=$(podman exec "$NAME" bash -c '
x86_64-w64-mingw32-g++ -DNOMINMAX -DWIN32 -DWIN32_LEAN_AND_MEAN -D_MT \
-D_WIN32_IE=0x0A00 -D_WIN32_WINNT=0x0A00 -D_WINDOWS -Werror -O2 -g \
-fvisibility=hidden -fstack-reuse=none -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 \
-std=c++20 -MD -save-temps -ffile-prefix-map=/tmp=. \
-o /tmp/bar.o -c /tmp/bar.cpp >/dev/null 2>&1
HASH=$(sha256sum /tmp/bar.o | awk "{print \$1}")
VER=$(x86_64-w64-mingw32-g++ --version | head -n 1)
echo "$HASH $VER"
')
echo "$DISTRO $ARCH $RESULT" >> "$OUTFILE"
done
doneThe script was printing: Edit: I also went ahead to de-reduce the above reproducer, so that it can be run on earlier versions of GCC. The non-determinism only happens in later GCC versions: de-reduced reproducer#include <cstddef>
#include <cstring>
#include <memory>
#include <new>
void unsafe_copy(void *dest) {
void *c;
unsigned f;
std::memcpy(dest, c, f);
}
class A {
public:
struct ay {
ay();
} az;
int ba[];
A(A &other) { unsafe_copy(ba); }
};
class C {
A bq;
};
int *n(void) {
unsigned g;
return static_cast<int *>(::operator new(g));
}
void construct_objects(int *h, int *j) {
int temp_obj = 0;
for (; h; ++j) {
new (reinterpret_cast<C *>(std::addressof(*j)))
C(*reinterpret_cast<C *>(std::addressof(temp_obj)));
}
}
template <class T> void construct_with_template(int, int *j, T) {
int dummy;
construct_objects(&dummy, j);
}
void main_function() {
int *data_ptr(n());
int dummy_var;
construct_with_template(dummy_var, data_ptr, 0);
}With the matrix script modified to set C++11 as standard, and some distros added, it prints: |
a797292 to
73b68ee
Compare
|
I didn't feel good about the UB in my reduced test case, and it looks too tedious to remove the UB again, so I started from scratch from the reproducer in #33775 (comment) and minimized it manually down to a C++-11 reproducer: #include <cstring> // Unused, but removing this makes it deterministic
#include <string>
#include <utility>
#include <vector>
struct Item {
Item(std::wstring path, std::string value)
: path(std::move(path)), value(std::move(value)) {}
std::wstring path;
std::string value;
};
bool has_new_paths();
std::vector<Item> Func() {
std::vector<Item> paths;
if (has_new_paths()) {
paths.emplace_back(std::wstring(), "a");
paths.emplace_back(std::wstring(), "aa");
paths.emplace_back(std::wstring(), "a");
paths.emplace_back(std::wstring(), "aa");
}
return paths;
}It was possible to reduce it further to still reproduce inside guix, but further reduction lead to matching hashes in my matrix.sh script for some unknown reason. Also, the reproducer only hit for GCC 14, and GCC 15, as expected, due to the So I went ahead and dropped `MiniVector` cpp reproducer code#include <algorithm>
#include <cstring> // Unused, but removing this makes it deterministic
#include <memory>
#include <stdexcept>
#include <string>
#include <utility>
struct Item {
Item(std::wstring path, std::string value)
: path(std::move(path)), value(std::move(value)) {}
std::wstring path;
std::string value;
};
struct MiniVector {
using allocator_type = std::allocator<Item>;
using allocator_traits = std::allocator_traits<allocator_type>;
MiniVector() = default;
MiniVector(MiniVector&& other) noexcept
: _M_alloc(std::move(other._M_alloc)),
_M_start(other._M_start),
_M_finish(other._M_finish),
_M_end_of_storage(other._M_end_of_storage) {
other._M_start = nullptr;
other._M_finish = nullptr;
other._M_end_of_storage = nullptr;
}
MiniVector& operator=(MiniVector&& other) noexcept {
if (this != &other) {
clear();
if (_M_start) {
_M_deallocate(_M_start, _M_end_of_storage - _M_start);
}
_M_alloc = std::move(other._M_alloc);
_M_start = other._M_start;
_M_finish = other._M_finish;
_M_end_of_storage = other._M_end_of_storage;
other._M_start = nullptr;
other._M_finish = nullptr;
other._M_end_of_storage = nullptr;
}
return *this;
}
~MiniVector() {
clear();
if (_M_start) {
_M_deallocate(_M_start, _M_end_of_storage - _M_start);
}
}
MiniVector(const MiniVector&) = delete;
MiniVector& operator=(const MiniVector&) = delete;
size_t size() const { return static_cast<size_t>(_M_finish - _M_start); }
void clear() {
_M_destroy(_M_start, _M_finish);
_M_finish = _M_start;
}
template <typename... Args>
void emplace_back(Args&&... args) {
if (_M_finish != _M_end_of_storage) {
_M_construct(_M_finish, std::forward<Args>(args)...);
++_M_finish;
return;
}
realloc_append(std::forward<Args>(args)...);
}
template <typename... Args>
void realloc_append(Args&&... args) {
const size_t __len = _M_check_len(1, "vector::_M_realloc_append");
size_t new_len = __len;
if (new_len == 0) __builtin_unreachable();
Item* __old_start = _M_start;
Item* __old_finish = _M_finish;
Item* __new_start = _M_allocate(__len);
Item* __new_finish = __new_start;
try {
Item* dst = __new_start;
for (Item* src = __old_start; src != __old_finish; ++src, ++dst) {
_M_construct(dst, std::move(*src));
}
__new_finish = dst;
_M_construct(__new_finish, std::forward<Args>(args)...);
++__new_finish;
} catch (...) {
_M_destroy(__new_start, __new_finish);
_M_deallocate(__new_start, __len);
throw;
}
_M_destroy(__old_start, __old_finish);
if (__old_start) {
_M_deallocate(__old_start, _M_end_of_storage - __old_start);
}
_M_start = __new_start;
_M_finish = __new_finish;
_M_end_of_storage = __new_start + __len;
}
private:
size_t _M_check_len(size_t __n, const char* __s) const {
const size_t __sz = size();
const size_t __max = max_size();
if (__max - __sz < __n) throw std::length_error(__s);
size_t __len = __sz + std::max(__sz, __n);
if (__len < __sz || __len > __max) __len = __max;
return __len;
}
size_t max_size() const { return allocator_traits::max_size(_M_alloc); }
Item* _M_allocate(size_t __n) {
return __n != 0 ? allocator_traits::allocate(_M_alloc, __n) : nullptr;
}
void _M_deallocate(Item* __p, size_t __n) {
if (__p) allocator_traits::deallocate(_M_alloc, __p, __n);
}
template <typename... Args>
void _M_construct(Item* __p, Args&&... __args) {
allocator_traits::construct(_M_alloc, __p, std::forward<Args>(__args)...);
}
void _M_destroy(Item* __first, Item* __last) {
while (__last != __first) {
--__last;
allocator_traits::destroy(_M_alloc, __last);
}
}
allocator_type _M_alloc;
Item* _M_start = nullptr;
Item* _M_finish = nullptr;
Item* _M_end_of_storage = nullptr;
};
bool has_new_paths();
MiniVector Func() {
MiniVector paths;
if (has_new_paths()) {
paths.emplace_back(std::wstring(), "a");
paths.emplace_back(std::wstring(), "aa");
paths.emplace_back(std::wstring(), "a");
paths.emplace_back(std::wstring(), "aa");
}
return paths;
}The matrix script output looks more promising to be able to find a "real" bisect result. Matrix script output |
|
So "MiniVector" leads the bisect to gcc-mirror/gcc@53ba8d6, which means that |
| Subject: [PATCH] Revert builtin_unreachable introduced in commit | ||
| 1d82fc2e6824bf83159389729c31a942f7b91b04. | ||
|
|
||
| For some reason, these make the build non-deterministic between |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. Pulled into the patch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I submitted gcc-mirror/gcc@c6085ca, which is probably easier to review? Also, it could make sense to use that commit, so that it can be easier dropped, once backported.
73b68ee to
d43d1eb
Compare
Prunes: libgomp.a libgomp.la libgomp.so libgomp.so.1 libgomp.so.1.0.0 libgomp.spec
Prunes: libquadmath.a libquadmath.la libquadmath.so libquadmath.so.0 libquadmath.so.0.0.0
This will eventually be needed for bitcoin#25573, and could be useful for bitcoin#30210.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My Guix build:
x86_64
40ad33c821da20854bd5c01127e0aeec4b387ca44c485655bfadc0c65a80e9ce guix-build-2a746500fa76/output/aarch64-linux-gnu/SHA256SUMS.part
fe01b5d9c7619a9f8b01cccad0655c9dfe3703ea053ff9438c6941d6e8b13c78 guix-build-2a746500fa76/output/aarch64-linux-gnu/bitcoin-2a746500fa76-aarch64-linux-gnu-debug.tar.gz
8d12bb46c0e4a6b178c821817250cdd00e6b16fa2e77e129b9224973e9ad0445 guix-build-2a746500fa76/output/aarch64-linux-gnu/bitcoin-2a746500fa76-aarch64-linux-gnu.tar.gz
600393616d9275202807b2f83a966f55f47d7313d9b9291587e3a4e9f23b6181 guix-build-2a746500fa76/output/arm-linux-gnueabihf/SHA256SUMS.part
9c75f854b3f3f92dd81081af789f32b60661fd0f5d1bd9973ccd7c3cff884196 guix-build-2a746500fa76/output/arm-linux-gnueabihf/bitcoin-2a746500fa76-arm-linux-gnueabihf-debug.tar.gz
08ac981dd5d5fb4dd943f0ea93a6281387a46b3c42c9b06a7ff0c99e39868f65 guix-build-2a746500fa76/output/arm-linux-gnueabihf/bitcoin-2a746500fa76-arm-linux-gnueabihf.tar.gz
2dbdffc0dcde53df241d8d67e1cce6a155425c3de55f08fc3483aa62181cfae9 guix-build-2a746500fa76/output/arm64-apple-darwin/SHA256SUMS.part
50e4268ff7039ca10c6b21b58322513c455a28477afeb61240a178ea23a72ab9 guix-build-2a746500fa76/output/arm64-apple-darwin/bitcoin-2a746500fa76-arm64-apple-darwin-codesigning.tar.gz
8137daa7a41a08279382fb63f2030802ddc538a32fe0cedae6db8e7897d53f29 guix-build-2a746500fa76/output/arm64-apple-darwin/bitcoin-2a746500fa76-arm64-apple-darwin-unsigned.tar.gz
2994d09b304cc0860b1b92553715933f3a54d53555cb60dcb6ebf57c2dc58a6e guix-build-2a746500fa76/output/arm64-apple-darwin/bitcoin-2a746500fa76-arm64-apple-darwin-unsigned.zip
2af7c1cb984b6eec476ff441e04fcc3f5a7d26f88a9e00f8773f08cd74e88a7b guix-build-2a746500fa76/output/dist-archive/bitcoin-2a746500fa76.tar.gz
dac539f42ea8115867ac3693e925f86c5ee7fbda7374e045f8c01473fceafb41 guix-build-2a746500fa76/output/powerpc64-linux-gnu/SHA256SUMS.part
1b66865391c52292a0739a6fa69024bf850c6b41f0768d4e9db045aeffc4c5c8 guix-build-2a746500fa76/output/powerpc64-linux-gnu/bitcoin-2a746500fa76-powerpc64-linux-gnu-debug.tar.gz
1faa4b649573ead908d51a43a78298ae0cd2015e6054bd8790d19acbdde74a5d guix-build-2a746500fa76/output/powerpc64-linux-gnu/bitcoin-2a746500fa76-powerpc64-linux-gnu.tar.gz
0388e0e34f28e1f65c1a0315603a8664529996871e062aa53bc10657663353c0 guix-build-2a746500fa76/output/riscv64-linux-gnu/SHA256SUMS.part
0f09706414d5a15456e146819aaefd08783c8f0732a4c38bfe105bb9d50387d0 guix-build-2a746500fa76/output/riscv64-linux-gnu/bitcoin-2a746500fa76-riscv64-linux-gnu-debug.tar.gz
0b3ef8bb5ec28d888f3c37ccf1ae95312fb4645c4c55770c95073091abe7fde4 guix-build-2a746500fa76/output/riscv64-linux-gnu/bitcoin-2a746500fa76-riscv64-linux-gnu.tar.gz
bcbb8f2a8e79874a6142e4eb605cf591a331f6a0448eac1801fe01996df22835 guix-build-2a746500fa76/output/x86_64-apple-darwin/SHA256SUMS.part
3d3abd9904e286562c22a7ab10bb992aa837b37554a4c151b7051bf2cdbaf483 guix-build-2a746500fa76/output/x86_64-apple-darwin/bitcoin-2a746500fa76-x86_64-apple-darwin-codesigning.tar.gz
63181d3518d3a913ce25bd3e220e8385701a76891209431ed6b6efe4e419a9bc guix-build-2a746500fa76/output/x86_64-apple-darwin/bitcoin-2a746500fa76-x86_64-apple-darwin-unsigned.tar.gz
4ea713112c04b367d257676966cab796a2ff00208a393df2c8fc2f8a5af73f0a guix-build-2a746500fa76/output/x86_64-apple-darwin/bitcoin-2a746500fa76-x86_64-apple-darwin-unsigned.zip
ace818bca8fc5041483b10ceeb9e1336fd26363781167decbc32c31cbb60fdd9 guix-build-2a746500fa76/output/x86_64-linux-gnu/SHA256SUMS.part
76628eb51a70ed7a47f7f8da72b414654a94a952f27ea0722d0625c5952bd505 guix-build-2a746500fa76/output/x86_64-linux-gnu/bitcoin-2a746500fa76-x86_64-linux-gnu-debug.tar.gz
2e65bee126f47702020d52c8c8f23871a39e121e983b5e5d6d04f5d9103dde57 guix-build-2a746500fa76/output/x86_64-linux-gnu/bitcoin-2a746500fa76-x86_64-linux-gnu.tar.gz
7b228241e4f8c8740424f9663b0fdfc362619897fdeb4eac69eee49aff4ebd45 guix-build-2a746500fa76/output/x86_64-w64-mingw32/SHA256SUMS.part
782fce8cfcaba112dc1633ee18a0d81a3a739186bbbd250303cb4393c4b5ba76 guix-build-2a746500fa76/output/x86_64-w64-mingw32/bitcoin-2a746500fa76-win64-codesigning.tar.gz
7b1da47aa555de00bf1f0720ad7464c2d3ccc40ebc257aa27fc1c02407d74ebd guix-build-2a746500fa76/output/x86_64-w64-mingw32/bitcoin-2a746500fa76-win64-debug.zip
ed26ec5df9f62a063c6239698008b71acf82f6e0d7e3ca0a023f7e7ff2094427 guix-build-2a746500fa76/output/x86_64-w64-mingw32/bitcoin-2a746500fa76-win64-setup-unsigned.exe
356fad06147ecc21007445ab5be5c72ea3125877f907e5ebc072686b610e2b35 guix-build-2a746500fa76/output/x86_64-w64-mingw32/bitcoin-2a746500fa76-win64-unsigned.zip
UPDATE: Got the same hashes on aarch64.
|
Guix Build (aarch64): 40ad33c821da20854bd5c01127e0aeec4b387ca44c485655bfadc0c65a80e9ce guix-build-2a746500fa76/output/aarch64-linux-gnu/SHA256SUMS.part
fe01b5d9c7619a9f8b01cccad0655c9dfe3703ea053ff9438c6941d6e8b13c78 guix-build-2a746500fa76/output/aarch64-linux-gnu/bitcoin-2a746500fa76-aarch64-linux-gnu-debug.tar.gz
8d12bb46c0e4a6b178c821817250cdd00e6b16fa2e77e129b9224973e9ad0445 guix-build-2a746500fa76/output/aarch64-linux-gnu/bitcoin-2a746500fa76-aarch64-linux-gnu.tar.gz
600393616d9275202807b2f83a966f55f47d7313d9b9291587e3a4e9f23b6181 guix-build-2a746500fa76/output/arm-linux-gnueabihf/SHA256SUMS.part
9c75f854b3f3f92dd81081af789f32b60661fd0f5d1bd9973ccd7c3cff884196 guix-build-2a746500fa76/output/arm-linux-gnueabihf/bitcoin-2a746500fa76-arm-linux-gnueabihf-debug.tar.gz
08ac981dd5d5fb4dd943f0ea93a6281387a46b3c42c9b06a7ff0c99e39868f65 guix-build-2a746500fa76/output/arm-linux-gnueabihf/bitcoin-2a746500fa76-arm-linux-gnueabihf.tar.gz
2dbdffc0dcde53df241d8d67e1cce6a155425c3de55f08fc3483aa62181cfae9 guix-build-2a746500fa76/output/arm64-apple-darwin/SHA256SUMS.part
50e4268ff7039ca10c6b21b58322513c455a28477afeb61240a178ea23a72ab9 guix-build-2a746500fa76/output/arm64-apple-darwin/bitcoin-2a746500fa76-arm64-apple-darwin-codesigning.tar.gz
8137daa7a41a08279382fb63f2030802ddc538a32fe0cedae6db8e7897d53f29 guix-build-2a746500fa76/output/arm64-apple-darwin/bitcoin-2a746500fa76-arm64-apple-darwin-unsigned.tar.gz
2994d09b304cc0860b1b92553715933f3a54d53555cb60dcb6ebf57c2dc58a6e guix-build-2a746500fa76/output/arm64-apple-darwin/bitcoin-2a746500fa76-arm64-apple-darwin-unsigned.zip
2af7c1cb984b6eec476ff441e04fcc3f5a7d26f88a9e00f8773f08cd74e88a7b guix-build-2a746500fa76/output/dist-archive/bitcoin-2a746500fa76.tar.gz
dac539f42ea8115867ac3693e925f86c5ee7fbda7374e045f8c01473fceafb41 guix-build-2a746500fa76/output/powerpc64-linux-gnu/SHA256SUMS.part
1b66865391c52292a0739a6fa69024bf850c6b41f0768d4e9db045aeffc4c5c8 guix-build-2a746500fa76/output/powerpc64-linux-gnu/bitcoin-2a746500fa76-powerpc64-linux-gnu-debug.tar.gz
1faa4b649573ead908d51a43a78298ae0cd2015e6054bd8790d19acbdde74a5d guix-build-2a746500fa76/output/powerpc64-linux-gnu/bitcoin-2a746500fa76-powerpc64-linux-gnu.tar.gz
0388e0e34f28e1f65c1a0315603a8664529996871e062aa53bc10657663353c0 guix-build-2a746500fa76/output/riscv64-linux-gnu/SHA256SUMS.part
0f09706414d5a15456e146819aaefd08783c8f0732a4c38bfe105bb9d50387d0 guix-build-2a746500fa76/output/riscv64-linux-gnu/bitcoin-2a746500fa76-riscv64-linux-gnu-debug.tar.gz
0b3ef8bb5ec28d888f3c37ccf1ae95312fb4645c4c55770c95073091abe7fde4 guix-build-2a746500fa76/output/riscv64-linux-gnu/bitcoin-2a746500fa76-riscv64-linux-gnu.tar.gz
bcbb8f2a8e79874a6142e4eb605cf591a331f6a0448eac1801fe01996df22835 guix-build-2a746500fa76/output/x86_64-apple-darwin/SHA256SUMS.part
3d3abd9904e286562c22a7ab10bb992aa837b37554a4c151b7051bf2cdbaf483 guix-build-2a746500fa76/output/x86_64-apple-darwin/bitcoin-2a746500fa76-x86_64-apple-darwin-codesigning.tar.gz
63181d3518d3a913ce25bd3e220e8385701a76891209431ed6b6efe4e419a9bc guix-build-2a746500fa76/output/x86_64-apple-darwin/bitcoin-2a746500fa76-x86_64-apple-darwin-unsigned.tar.gz
4ea713112c04b367d257676966cab796a2ff00208a393df2c8fc2f8a5af73f0a guix-build-2a746500fa76/output/x86_64-apple-darwin/bitcoin-2a746500fa76-x86_64-apple-darwin-unsigned.zip
ace818bca8fc5041483b10ceeb9e1336fd26363781167decbc32c31cbb60fdd9 guix-build-2a746500fa76/output/x86_64-linux-gnu/SHA256SUMS.part
76628eb51a70ed7a47f7f8da72b414654a94a952f27ea0722d0625c5952bd505 guix-build-2a746500fa76/output/x86_64-linux-gnu/bitcoin-2a746500fa76-x86_64-linux-gnu-debug.tar.gz
2e65bee126f47702020d52c8c8f23871a39e121e983b5e5d6d04f5d9103dde57 guix-build-2a746500fa76/output/x86_64-linux-gnu/bitcoin-2a746500fa76-x86_64-linux-gnu.tar.gz
7b228241e4f8c8740424f9663b0fdfc362619897fdeb4eac69eee49aff4ebd45 guix-build-2a746500fa76/output/x86_64-w64-mingw32/SHA256SUMS.part
782fce8cfcaba112dc1633ee18a0d81a3a739186bbbd250303cb4393c4b5ba76 guix-build-2a746500fa76/output/x86_64-w64-mingw32/bitcoin-2a746500fa76-win64-codesigning.tar.gz
7b1da47aa555de00bf1f0720ad7464c2d3ccc40ebc257aa27fc1c02407d74ebd guix-build-2a746500fa76/output/x86_64-w64-mingw32/bitcoin-2a746500fa76-win64-debug.zip
ed26ec5df9f62a063c6239698008b71acf82f6e0d7e3ca0a023f7e7ff2094427 guix-build-2a746500fa76/output/x86_64-w64-mingw32/bitcoin-2a746500fa76-win64-setup-unsigned.exe
356fad06147ecc21007445ab5be5c72ea3125877f907e5ebc072686b610e2b35 guix-build-2a746500fa76/output/x86_64-w64-mingw32/bitcoin-2a746500fa76-win64-unsigned.zip |
hebasto
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 2a74650. I have reviewed the code and it looks OK. The new GCC patch looks reasonable.
theuni
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 2a74650
Left a comment about usage of openmp, though I don't think it's a problem.
Out of curiosity though, is it only disabled to safe on compilation time and size? Or does it avoid some problem?
| (list "--enable-threads=posix", | ||
| "--enable-default-ssp=yes", | ||
| "--disable-gcov", | ||
| "--disable-libgomp", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure that none of our dependencies use this anywhere? From a quick look, it doesn't seem like gcc itself does. And libstdc++ does, but only for the experimental parallel/* ts.
I'd hate to see us quietly losing performance somewhere. But as far as I can tell, none of our deps are using it at the moment.
The shasum output here is identical for x86_64 & aarch64. Based on Maras comment here: bitcoin#33775 (comment). You can checkout this commit and run ./contrib/guix/guix-build.
|
Nice work @maflcko! Guix build (aarch64): |
sedited
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 2a74650
Switching to using GCC 14.x for release builds has come up multiple times recently. It will eventually be needed for #25573, and could also be useful for #30210.