The proprietary nvidia drivers on linux generate an enormous amount of these spurious valgrind errors when linked into your program:

==360480== Conditional jump or move depends on uninitialised value(s)
==360480==    at 0x7306520: ??? (in /usr/lib/libnvidia-glcore.so.570.153.02)
==360480==    by 0x6CA1AA8: ??? (in /usr/lib/libnvidia-glcore.so.570.153.02)
==360480==    by 0x723D682: ??? (in /usr/lib/libnvidia-glcore.so.570.153.02)
==360480==    by 0x6C98B6C: ??? (in /usr/lib/libnvidia-glcore.so.570.153.02)
==360480==    by 0x6100B10: ??? (in /usr/lib/libGLX_nvidia.so.570.153.02)
==360480==    by 0x615BEE1: ??? (in /usr/lib/libGLX_nvidia.so.570.153.02)
==360480==    by 0x6100012: ??? (in /usr/lib/libGLX_nvidia.so.570.153.02)
==360480==    by 0x406A3CC: _dl_init (dl-init.c:121)
==360480==    by 0x40674B4: _dl_catch_exception (dl-catch.c:215)
==360480==    by 0x40710C8: dl_open_worker (dl-open.c:799)
==360480==    by 0x4067415: _dl_catch_exception (dl-catch.c:241)
==360480==    by 0x40714DD: _dl_open (dl-open.c:874)

To fix this, you can give valgrind a "suppression file" which marks specific errors as spurious so that they can be ignored. These suppression files are really tedious to generate, however, so I wrote this script to help with that:

#!/usr/bin/env bash

# takes in a command invocation, runs it under valgrind, and then generates a suppressions file
# for every error that shows up
#
# this is handy when some third party library is generating a shitload of random errors (looking
# at you, proprietary nvidia drivers)
#
# for example:
# > generate-suppressions.bash ./bin/someprogram > valgrind-suppressions.txt
# > valgrind --suppressions=valgrind-suppressions.txt ./bin/someprogram

target="$1"

if [[ -z $target ]]; then
    echo "no invocation specified"
    exit 1
fi

out="$(mktemp)"

yes | valgrind --gen-suppressions=yes $target 2> "$out"

out_stripped="$(mktemp)"

awk '/^[^=].*$/ { print $0 }' < "$out" > "$out_stripped"

py=$(cat << EOF
import sys
src = sys.stdin.read()
import re
cursor = 0
i = 0
for m in re.finditer(r'   <insert_a_suppression_name_here>', src):
    print(src[cursor:m.start()])
    print(f"{{\n   suppression_{i}", end="")
    i += 1
    cursor = m.end()
print(src[cursor:])
EOF
)

python -c "$py" < "$out_stripped"

This is not the nicest bash, and I broke it out into some python because I couldn't figure out how to do it all with typical shell tools -- but it works, and it made things way easier for me, so I thought I'd share it for anyone else who comes across this problem.