official-stockfish / Stockfish

A free and strong UCI chess engine
https://stockfishchess.org/
GNU General Public License v3.0
11.56k stars 2.28k forks source link

gcc gives warning when compiling on Raspberry Pi 5 #4932

Open Torom opened 10 months ago

Torom commented 10 months ago

Describe the issue

gcc compiles successfully, but gives the following warning:

In member function ‘propagate’,
    inlined from ‘propagate’ at nnue/nnue_architecture.h:107:23,
    inlined from ‘evaluate’ at nnue/evaluate_nnue.cpp:180:55:
nnue/layers/affine_transform_sparse_input.h:249:32: warning: ‘transformedFeatures’ may be used uninitialized [-Wmaybe-uninitialized]
  249 |             const invec_t in = vec_set_32(input32[i]);
      |                                ^
nnue/evaluate_nnue.cpp: In function ‘evaluate’:
nnue/evaluate_nnue.cpp:173:47: note: ‘transformedFeatures’ declared here
  173 |     alignas(alignment) TransformedFeatureType transformedFeatures[FeatureTransformer::BufferSize];
      |

Expected behavior

no warning

Steps to reproduce

$ make build ARCH=armv8 COMP=gcc

Anything else?

$ gcc --version
gcc (Ubuntu 13.2.0-4ubuntu3) 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Clang compiles without warning.

Operating system

Ubuntu Server 23.10

Stockfish version

fbdf5d9

Sopel97 commented 10 months ago

post the full makefile log

Torom commented 10 months ago
$ make build ARCH=armv8 COMP=gcc
Default net: nn-0000000000a0.nnue
nn-0000000000a0.nnue available : OK
Network validated

Config:
debug: 'no'
sanitize: 'none'
optimize: 'yes'
arch: 'armv8'
bits: '64'
kernel: 'Linux'
os: 'GNU/Linux'
prefetch: 'yes'
popcnt: 'yes'
pext: 'no'
sse: 'no'
mmx: 'no'
sse2: 'no'
ssse3: 'no'
sse41: 'no'
avx2: 'no'
avxvnni: 'no'
avx512: 'no'
vnni256: 'no'
vnni512: 'no'
neon: 'yes'
dotprod: 'no'
arm_version: '8'
target_windows: ''

Flags:
CXX: g++
CXXFLAGS:  -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -Wmissing-declarations -DUSE_PTHREADS -DNDEBUG -O3 -funroll-loops -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -DGIT_SHA=fbdf5d94 -DGIT_DATE=20231222 -DARCH=armv8 -flto -flto-partition=one
LDFLAGS:   -Wl,--no-as-needed -lpthread  -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -Wmissing-declarations -DUSE_PTHREADS -DNDEBUG -O3 -funroll-loops -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -DGIT_SHA=fbdf5d94 -DGIT_DATE=20231222 -DARCH=armv8 -flto -flto-partition=one -flto=jobserver

Testing config sanity. If this fails, try 'make help' ...

make ARCH=armv8 COMP=gcc all
make[1]: Entering directory '/home/torsten/chess/Stockfish_master/src'
g++  -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -Wmissing-declarations -DUSE_PTHREADS -DNDEBUG -O3 -funroll-loops -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -DGIT_SHA=fbdf5d94 -DGIT_DATE=20231222 -DARCH=armv8 -flto -flto-partition=one   -c -o benchmark.o benchmark.cpp
g++  -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -Wmissing-declarations -DUSE_PTHREADS -DNDEBUG -O3 -funroll-loops -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -DGIT_SHA=fbdf5d94 -DGIT_DATE=20231222 -DARCH=armv8 -flto -flto-partition=one   -c -o bitboard.o bitboard.cpp
g++  -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -Wmissing-declarations -DUSE_PTHREADS -DNDEBUG -O3 -funroll-loops -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -DGIT_SHA=fbdf5d94 -DGIT_DATE=20231222 -DARCH=armv8 -flto -flto-partition=one   -c -o evaluate.o evaluate.cpp
g++  -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -Wmissing-declarations -DUSE_PTHREADS -DNDEBUG -O3 -funroll-loops -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -DGIT_SHA=fbdf5d94 -DGIT_DATE=20231222 -DARCH=armv8 -flto -flto-partition=one   -c -o main.o main.cpp
g++  -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -Wmissing-declarations -DUSE_PTHREADS -DNDEBUG -O3 -funroll-loops -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -DGIT_SHA=fbdf5d94 -DGIT_DATE=20231222 -DARCH=armv8 -flto -flto-partition=one   -c -o misc.o misc.cpp
g++  -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -Wmissing-declarations -DUSE_PTHREADS -DNDEBUG -O3 -funroll-loops -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -DGIT_SHA=fbdf5d94 -DGIT_DATE=20231222 -DARCH=armv8 -flto -flto-partition=one   -c -o movegen.o movegen.cpp
g++  -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -Wmissing-declarations -DUSE_PTHREADS -DNDEBUG -O3 -funroll-loops -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -DGIT_SHA=fbdf5d94 -DGIT_DATE=20231222 -DARCH=armv8 -flto -flto-partition=one   -c -o movepick.o movepick.cpp
g++  -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -Wmissing-declarations -DUSE_PTHREADS -DNDEBUG -O3 -funroll-loops -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -DGIT_SHA=fbdf5d94 -DGIT_DATE=20231222 -DARCH=armv8 -flto -flto-partition=one   -c -o position.o position.cpp
g++  -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -Wmissing-declarations -DUSE_PTHREADS -DNDEBUG -O3 -funroll-loops -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -DGIT_SHA=fbdf5d94 -DGIT_DATE=20231222 -DARCH=armv8 -flto -flto-partition=one   -c -o search.o search.cpp
g++  -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -Wmissing-declarations -DUSE_PTHREADS -DNDEBUG -O3 -funroll-loops -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -DGIT_SHA=fbdf5d94 -DGIT_DATE=20231222 -DARCH=armv8 -flto -flto-partition=one   -c -o thread.o thread.cpp
g++  -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -Wmissing-declarations -DUSE_PTHREADS -DNDEBUG -O3 -funroll-loops -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -DGIT_SHA=fbdf5d94 -DGIT_DATE=20231222 -DARCH=armv8 -flto -flto-partition=one   -c -o timeman.o timeman.cpp
g++  -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -Wmissing-declarations -DUSE_PTHREADS -DNDEBUG -O3 -funroll-loops -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -DGIT_SHA=fbdf5d94 -DGIT_DATE=20231222 -DARCH=armv8 -flto -flto-partition=one   -c -o tt.o tt.cpp
g++  -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -Wmissing-declarations -DUSE_PTHREADS -DNDEBUG -O3 -funroll-loops -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -DGIT_SHA=fbdf5d94 -DGIT_DATE=20231222 -DARCH=armv8 -flto -flto-partition=one   -c -o uci.o uci.cpp
g++  -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -Wmissing-declarations -DUSE_PTHREADS -DNDEBUG -O3 -funroll-loops -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -DGIT_SHA=fbdf5d94 -DGIT_DATE=20231222 -DARCH=armv8 -flto -flto-partition=one   -c -o ucioption.o ucioption.cpp
g++  -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -Wmissing-declarations -DUSE_PTHREADS -DNDEBUG -O3 -funroll-loops -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -DGIT_SHA=fbdf5d94 -DGIT_DATE=20231222 -DARCH=armv8 -flto -flto-partition=one   -c -o tune.o tune.cpp
g++  -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -Wmissing-declarations -DUSE_PTHREADS -DNDEBUG -O3 -funroll-loops -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -DGIT_SHA=fbdf5d94 -DGIT_DATE=20231222 -DARCH=armv8 -flto -flto-partition=one   -c -o tbprobe.o syzygy/tbprobe.cpp
g++  -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -Wmissing-declarations -DUSE_PTHREADS -DNDEBUG -O3 -funroll-loops -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -DGIT_SHA=fbdf5d94 -DGIT_DATE=20231222 -DARCH=armv8 -flto -flto-partition=one   -c -o evaluate_nnue.o nnue/evaluate_nnue.cpp
g++  -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -Wmissing-declarations -DUSE_PTHREADS -DNDEBUG -O3 -funroll-loops -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -DGIT_SHA=fbdf5d94 -DGIT_DATE=20231222 -DARCH=armv8 -flto -flto-partition=one   -c -o half_ka_v2_hm.o nnue/features/half_ka_v2_hm.cpp
g++ -o stockfish benchmark.o bitboard.o evaluate.o main.o misc.o movegen.o movepick.o position.o search.o thread.o timeman.o tt.o uci.o ucioption.o tune.o tbprobe.o evaluate_nnue.o half_ka_v2_hm.o   -Wl,--no-as-needed -lpthread  -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -Wmissing-declarations -DUSE_PTHREADS -DNDEBUG -O3 -funroll-loops -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -DGIT_SHA=fbdf5d94 -DGIT_DATE=20231222 -DARCH=armv8 -flto -flto-partition=one -flto=jobserver
In member function ‘propagate’,
    inlined from ‘propagate’ at nnue/nnue_architecture.h:107:23,
    inlined from ‘evaluate’ at nnue/evaluate_nnue.cpp:180:55:
nnue/layers/affine_transform_sparse_input.h:249:32: warning: ‘transformedFeatures’ may be used uninitialized [-Wmaybe-uninitialized]
  249 |             const invec_t in = vec_set_32(input32[i]);
      |                                ^
nnue/evaluate_nnue.cpp: In function ‘evaluate’:
nnue/evaluate_nnue.cpp:173:47: note: ‘transformedFeatures’ declared here
  173 |     alignas(alignment) TransformedFeatureType transformedFeatures[FeatureTransformer::BufferSize];
      |                                               ^
make[1]: Leaving directory '/home/torsten/chess/Stockfish_master/src'
Sopel97 commented 10 months ago

the build completed successufully

Torom commented 10 months ago

oh, you're right

vondele commented 7 months ago

can confirm here on aarch64. Valgrind is not functional on the system I have access to, but it would be interesting if @Torom would run once something like valgrind ./stockfish bench

Disservin commented 2 months ago

something like valgrind ./stockfish bench

doesn't work, valgrind is missing instructions

disInstr(arm64): unhandled instruction 0x4E8E95F3
disInstr(arm64): 0100'1110 1000'1110 1001'0101 1111'0011
==1828261== valgrind: Unrecognised instruction at address 0x138e50.
Torom commented 2 months ago

Sorry, the communication was continued here on Discord at the time: https://discord.com/channels/435943710472011776/813919248455827515/1223582929041752064

Disservin commented 2 months ago

ah thanks seems like it was fixed some time ago

vondele commented 2 months ago

nah, the warning is still there I think.

Disservin commented 2 months ago

nah, the warning is still there I think.

Yes it is, but I was talking about the valgrind error