[Bug 278089] Crash with clang++ 16 building stockfish-official

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 02 Apr 2024 17:33:58 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=278089

--- Comment #4 from Dimitry Andric <dim@FreeBSD.org> ---
(In reply to Paul Floyd from comment #3)
No need, I can reproduce the problem on a 14.0 VM here, though I couldn't use
ARCH=armv8-dotprod as my version of clang does not support that target.
Instead, I used ARCH=x86-64-sse41-popcnt which is a mostly common denominator
for amd64 machines:

$ gmake profile-build ARCH=x86-64-sse41-popcnt MAKE=gmake CC=clang CXX=clang++
...
Step 3/4. Building optimized executable ...
gmake ARCH=x86-64-sse41-popcnt COMP=gcc objclean
gmake[1]: Entering directory '/home/dim/bugs/bug278089/stockfish/src'
gmake[1]: Leaving directory '/home/dim/bugs/bug278089/stockfish/src'
gmake ARCH=x86-64-sse41-popcnt COMP=gcc clang-profile-use
gmake[1]: Entering directory '/home/dim/bugs/bug278089/stockfish/src'
llvm-profdata merge -output=stockfish.profdata *.profraw
gmake ARCH=x86-64-sse41-popcnt COMP=gcc \
EXTRACXXFLAGS='-fprofile-instr-use=stockfish.profdata' \
EXTRALDFLAGS='-fprofile-use ' \
all
gmake[2]: Entering directory '/home/dim/bugs/bug278089/stockfish/src'
clang++  -Wall -Wcast-qual -fno-exceptions -std=c++17
-fprofile-instr-use=stockfish.profdata -pedantic -Wextra -Wshadow
-Wmissing-declarations -m64 -DUSE_PTHREADS -DNDEBUG -O3 -funroll-loops
-DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3
-mssse3 -DUSE_SSE2 -msse2 -DGIT_SHA=0716b845 -DGIT_DATE=20240402
-DARCH=x86-64-sse41-popcnt -flto=full   -c -o benchmark.o benchmark.cpp
Expected<T> must be checked before access or destruction.
Expected<T> value was in success state. (Note: Expected<T> values in success
mode must still be checked prior to being destroyed).
...

followed by the backtrace.

At this point I tried clang 17.0.6 from the lang/llvm17 port (but this has
assertions disabled), and also clang 17.0.6 from 15.0-CURRENT, which does have
assertions enabled. Both worked fine.

I am assuming this is something fixed between clang 16.0 and 17.0, but I
haven't found the exact fix(es). I'm not sure any of those would help you right
now, if you are on 14.0-RELEASE, so please try using the lang/llvm17 port or
package instead, with CC=clang17 CXX=clang++17.

-- 
You are receiving this mail because:
You are the assignee for the bug.