Compilation breaks on Fedora 35 - segfault

Discussion of chess software programming and technical issues.

Moderator: Ras

ydebilloez
Posts: 186
Joined: Tue Jun 27, 2017 11:01 pm
Location: Lubumbashi
Full name: Yves De Billoëz

Compilation breaks on Fedora 35 - segfault

Post by ydebilloez »

Please find below script that is working fine when running in Fedora 34, but not in Fedora 35.
In Fedora 34, using gcc 11.2, mingw gcc 10.2 and clang12, all is running fine.
In Fedora 35, using gcc 11.2, mingw gcc 11.2 and clang13, static builds on linux target are creating a segfault in some part of the code.
Running in debug code, no segfault. Windows target, no segfault neither.

Code: Select all

g++ -std=c++11 -m64 -O3 -Ofast -static -static-libstdc++ -flto -funroll-loops -fopenmp \
  	         ../src/*.cpp -pthread -s -o ../dist/broken-gcc-target
g++ -std=c++11 -m64 -O3 -Ofast -march=native -flto -funroll-loops -fopenmp \
               -ffast-math -fno-math-errno -funsafe-math-optimizations -freciprocal-math -ffinite-math-only -fno-rtti \
  	           ../src/*.cpp -pthread -s -o ../dist/running-gcc-target
clang++ -m64 -O3 -Ofast -march=native -flto -stdlib=libstdc++ \
             ../src/*.cpp -pthread -s -o ../dist/running-clang-target
clang++ -m64 -O3 -Ofast -flto -static -stdlib=libstdc++ -L/usr/lib/x86_64-linux-gnu \
             ../src/*.cpp -pthread -s -o ../dist/broken-clang-target
x86_64-w64-mingw32-c++ -std=c++11 -m64 -O3 -Ofast -static -static-libgcc -static-libstdc++ \
            -flto -funroll-loops -pthread -L/usr/x86_64-w64-mingw32/sys-root/mingw/lib \
            ../src/*.cpp -pthread -s -o ../dist/running-gcc-target.exe
I found some reference to --whole-archive -lpthread, --no-whole-archive. pthread lib also moved to libstdc++ at some point...

Any clues?

Ps: code taken from my belofte project.
Yves De Billoëz @ macchess belofte chess
Once owner of a Mephisto I, II, challenger, ... chess computer.
abulmo2
Posts: 479
Joined: Fri Dec 16, 2016 11:04 am
Location: France
Full name: Richard Delorme

Re: Compilation breaks on Fedora 35 - segfault

Post by abulmo2 »

What is crashing, your program or the compiler?
If it is your program, it is probably a bug in it that happens when some compiler optimization are turned on. Quite often this kind of crash occurs when some undefined behaviour are invoked by a program. First, try to put all warning on (-W -Wall -Wextra) when compiling and to correct them all. Otherwise good luck to find your bug.
Richard Delorme
ydebilloez
Posts: 186
Joined: Tue Jun 27, 2017 11:01 pm
Location: Lubumbashi
Full name: Yves De Billoëz

Re: Compilation breaks on Fedora 35 - segfault

Post by ydebilloez »

The program crashes. Compilation with all warnings on gives no warnings.
Launch the program with --uci parameter and issue 'go depth 1' command. If compiled with stock compiler Fedora 34, it's ok. With Fedora 35 it crashes. However, running with the --bench command runs fine in both cases.
Yves De Billoëz @ macchess belofte chess
Once owner of a Mephisto I, II, challenger, ... chess computer.