I'm working on the update of devel/capnproto to 0.9.0 as specified in bug #257919. In my current, clang chokes with the following error: Assertion failed: ((T->isAnyPointerType() || T->isBlockPointerType()) && "Invalid type"), function isPointerZeroInitializable, file /usr/local/poudriere/jails/13-current/usr/src/contrib/llvm-project/clang/lib/CodeGen/CodeGenTypes.cpp, line 869. PLEASE submit a bug report to https://bugs.freebsd.org/submit/ and include the crash backtrace, preprocessed source, and associated run script. Stack dump: 0. Program arguments: c++ -DHAVE_CONFIG_H -I. -I./src -I./src -DKJ_HEADER_WARNINGS -DCAPNP_HEADER_WARNINGS -DCAPNP_INCLUDE_DIR="/usr/local/include" -D_THREAD_SAFE -pthread -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -D_THREAD_SAFE -pthread -DKJ_HAS_ZLIB -DKJ_HAS_OPENSSL -MT src/capnp/compiler/capnpc-c++.o -MD -MP -MF src/capnp/compiler/.deps/capnpc-c++.Tpo -c -o src/capnp/compiler/capnpc-c++.o src/capnp/compiler/capnpc-c++.c++ 1. <eof> parser at end of file 2. Per-file LLVM IR generation 3. ./src/kj/debug.h:655:3 <Spelling=./src/kj/debug.h:650:25>: Generating code for declaration 'kj::_::DebugExpression<kj::StringPtr &>::operator!=' depbase=`echo src/capnp/compiler/parser.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\ /bin/sh ./libtool --tag=CXX --mode=compile c++ -DHAVE_CONFIG_H -I. -I./src -I./src -DKJ_HEADER_WARNINGS -DCAPNP_HEADER_WARNINGS -DCAPNP_INCLUDE_DIR='"/usr/local/include"' -D_THREAD_SAFE -pthread -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -D_THREAD_SAFE -pthread -DKJ_HAS_ZLIB -DKJ_HAS_OPENSSL -MT src/capnp/compiler/parser.lo -MD -MP -MF $depbase.Tpo -c -o src/capnp/compiler/parser.lo src/capnp/compiler/parser.c++ &&\ mv -f $depbase.Tpo $depbase.Plo libtool: compile: c++ -DHAVE_CONFIG_H -I. -I./src -I./src -DKJ_HEADER_WARNINGS -DCAPNP_HEADER_WARNINGS -DCAPNP_INCLUDE_DIR=\"/usr/local/include\" -D_THREAD_SAFE -pthread -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -D_THREAD_SAFE -pthread -DKJ_HAS_ZLIB -DKJ_HAS_OPENSSL -MT src/capnp/compiler/parser.lo -MD -MP -MF src/capnp/compiler/.deps/parser.Tpo -c src/capnp/compiler/parser.c++ -fPIC -DPIC -o src/capnp/compiler/.libs/parser.o #0 0x00000000041e71ce PrintStackTrace /usr/local/poudriere/jails/13-current/usr/src/contrib/llvm-project/llvm/lib/Support/Unix/Signals.inc:564:13 #1 0x00000000041e5425 RunSignalHandlers /usr/local/poudriere/jails/13-current/usr/src/contrib/llvm-project/llvm/lib/Support/Signals.cpp:69:18 #2 0x000000000418490e HandleCrash /usr/local/poudriere/jails/13-current/usr/src/contrib/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:77:5 #3 0x0000000004184a91 CrashRecoverySignalHandler /usr/local/poudriere/jails/13-current/usr/src/contrib/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:0:51 #4 0x00000008056a7010 handle_signal /usr/local/poudriere/jails/13-current/usr/src/lib/libthr/thread/thr_sig.c:0:3 c++: error: clang frontend command failed due to signal (use -v to see invocation) FreeBSD clang version 11.0.1 (git@github.com:llvm/llvm-project.git llvmorg-11.0.1-0-g43ff75f2c3fe) Target: x86_64-unknown-freebsd14.0 Thread model: posix InstalledDir: /usr/bin c++: note: diagnostic msg: ******************** PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: Preprocessed source(s) and associated run script(s) are located at: c++: note: diagnostic msg: /tmp/capnpc-c++-161d22.cpp c++: note: diagnostic msg: /tmp/capnpc-c++-161d22.sh c++: note: diagnostic msg: ******************** gmake[1]: *** [Makefile:2307: src/capnp/compiler/capnpc-c++.o] Error 254 gmake[1]: *** Waiting for unfinished jobs.... The host machine is FreeBSD vm-current 14.0-CURRENT FreeBSD 14.0-CURRENT #14 main-n247765-31914882fca5: Thu Jul 8 07:11:23 CEST 2021 root@vm-current:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64 and the port is built in poudriere (yeah, the name of the jail is 13-current, but it actually runs 14.0-current... is confusing): [fernape@vm-current /usr/local/poudriere/ports/default]$ poudriere jail -l JAILNAME VERSION ARCH METHOD TIMESTAMP PATH 13-current 14.0-CURRENT 1400013 50d31dbc6 amd64 git+https 2021-05-02 17:11:19 /usr/local/poudriere/jails/13-current
I can not attach the .cpp file due to its size (4.0MB). The file and the reproducer script can be taken from /home/fernape/bug_257961 in freefall. Thanks!
FWIW, I updated both currents (host and jail) and I can not reproduce this anymore. build of devel/capnproto | capnproto-0.9.0 ended at Sat Aug 21 13:21:33 CEST 2021 build time: 00:04:32 [00:26:01] Logs: /usr/local/poudriere/data/logs/bulk/current-default/2021-08-21_12h55m33s [00:26:01] Cleaning up [00:26:01] Unmounting file systems [fernape@vm-current ~]$ uname -a FreeBSD vm-current 14.0-CURRENT FreeBSD 14.0-CURRENT #0 main-n248803-eba8e643b19: Thu Aug 19 08:47:12 UTC 2021 root@releng1.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64 [fernape@vm-current ~]$ poudriere jail -l current 14.0-CURRENT 1400030 5d75ffdd0 amd64 git+https 2021-08-20 22:34:46 /usr/local/poudriere/jails/current Do you want me to keep this PR open? It does not block capnproto anymore.
I couldn't reproduce with clang 12.0.1 in 14.0-CURRENT (main-n248773-d75b0870e542 as of 2021-08-18), so it's an issue with clang 11.0.1. It might still be interesting to fix for e.g. stable/11 which has clang 11. (Although this might only happen with assertions enabled.)
A commit in branch stable/12 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=b65d87e5d7b58fd06cf4a3061b564d62f1033999 commit b65d87e5d7b58fd06cf4a3061b564d62f1033999 Author: Dimitry Andric <dim@FreeBSD.org> AuthorDate: 2021-08-21 14:26:51 +0000 Commit: Dimitry Andric <dim@FreeBSD.org> CommitDate: 2021-08-21 15:13:37 +0000 Apply upstream clang fix for assertion failure compiling devel/capnproto Merge commit 48c70c1664aa from llvm git (by Richard Smith): Extend memset-to-zero optimization to C++11 aggregate functional casts Aggr{...}. We previously missed these cases due to not stepping over the additional AST nodes representing their syntactic form. Direct commit to stable/12, as both main and stable/13 already have this fix as part of clang 12.0.1. Reported by: fernape PR: 257961 contrib/llvm-project/clang/lib/CodeGen/CGExprAgg.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
A commit in branch stable/11 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=d5c7f929b50dbd5965c500ab42c93d0a2736ef99 commit d5c7f929b50dbd5965c500ab42c93d0a2736ef99 Author: Dimitry Andric <dim@FreeBSD.org> AuthorDate: 2021-08-21 15:13:10 +0000 Commit: Dimitry Andric <dim@FreeBSD.org> CommitDate: 2021-08-21 15:14:00 +0000 Apply upstream clang fix for assertion failure compiling devel/capnproto Merge commit 48c70c1664aa from llvm git (by Richard Smith): Extend memset-to-zero optimization to C++11 aggregate functional casts Aggr{...}. We previously missed these cases due to not stepping over the additional AST nodes representing their syntactic form. Direct commit to stable/11, as both main and stable/13 already have this fix as part of clang 12.0.1. Reported by: fernape PR: 257961 contrib/llvm-project/clang/lib/CodeGen/CGExprAgg.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)