Bug 269067 - Build of devel/boost-libs fails because of assertion failure of clang on 14-CURRENT
Summary: Build of devel/boost-libs fails because of assertion failure of clang on 14-C...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: Dimitry Andric
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-20 06:01 UTC by Yasuhiro Kimura
Modified: 2024-03-21 07:02 UTC (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yasuhiro Kimura freebsd_committer freebsd_triage 2023-01-20 06:01:21 UTC
yasu@rolling-vm-freebsd1[1018]% uname -a
FreeBSD rolling-vm-freebsd1.home.utahime.org 14.0-CURRENT FreeBSD 14.0-CURRENT #0 main-n260055-8bce8d28abe: Sat Jan 14 01:06:42 JST 2023     rootz@rolling-vm-freebsd1.home.utahime.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64
yasu@rolling-vm-freebsd1[1018]%

After devel/boost-libs is updated to 1.81.0, build of the port fails
on 14-CURRENT because of assersion failure of clang in base system.

----------------------------------------------------------------------
clang-linux.compile.c++ bin.v2/libs/url/build/clang-linux-14/release/pch-off/threading-multi/visibility-hidden/src.o

  "c++" -c -x c++ -fvisibility-inlines-hidden -fPIC -m64 -pthread -O3 -Wall -fvisibility=hidden -Wno-inline -pipe -DLIBICONV_PLUG -fstack-protector-strong -fno-strict-aliasing -DLIBICONV_PLUG -std=gnu++17 -pipe -DLIBICONV_PLUG -fstack-protector-strong -fno-strict-aliasing -DBOOST_ALL_NO_LIB=1 -DBOOST_URL_DYN_LINK=1 -DBOOST_URL_SOURCE -DNDEBUG -I"."   -o "bin.v2/libs/url/build/clang-linux-14/release/pch-off/threading-multi/visibility-hidden/src.o" "libs/url/src/src.cpp"

Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file /usr/src/contrib/llvm-project/llvm/include/llvm/Support/Casting.h, line 269.
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++ -c -x c++ -fvisibility-inlines-hidden -fPIC -m64 -pthread -O3 -Wall -fvisibility=hidden -Wno-inline -pipe -DLIBICONV_PLUG -fstack-protector-strong -fno-strict-aliasing -DLIBICONV_PLUG -std=gnu++17 -pipe -DLIBICONV_PLUG -fstack-protector-strong -fno-strict-aliasing -DBOOST_ALL_NO_LIB=1 -DBOOST_URL_DYN_LINK=1 -DBOOST_URL_SOURCE -DNDEBUG -I. -o bin.v2/libs/url/build/clang-linux-14/release/pch-off/threading-multi/visibility-hidden/src.o libs/url/src/src.cpp
1.	./boost/url/impl/segments_view.ipp:33:1: current parser token '{'
2.	./boost/url/impl/segments_view.ipp:17:1: parsing namespace 'boost'
3.	./boost/url/impl/segments_view.ipp:18:1: parsing namespace 'boost::urls'
 #0 0x00000000050b98d1 PrintStackTrace /usr/src/contrib/llvm-project/llvm/lib/Support/Unix/Signals.inc:565:13
 #1 0x00000000050b7c05 RunSignalHandlers /usr/src/contrib/llvm-project/llvm/lib/Support/Signals.cpp:98:18
 #2 0x000000000505fe2e HandleCrash /usr/src/contrib/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:79:5
 #3 0x000000000505fff3 CrashRecoverySignalHandler /usr/src/contrib/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:0:51
 #4 0x000000082b39da60 handle_signal /usr/src/lib/libthr/thread/thr_sig.c:0:3
 #5 0x000000082b39d01f thr_sighandler /usr/src/lib/libthr/thread/thr_sig.c:247:1
 #6 0x00000008282f92d3 ([vdso]+0x2d3)
 #7 0x000000082d52a99a __sys_thr_kill /usr/obj/usr/src/amd64.amd64/lib/libc/thr_kill.S:4:0
 #8 0x000000082d4a3044 __raise /usr/src/lib/libc/gen/raise.c:0:10
 #9 0x000000082d5547b9 abort /usr/src/lib/libc/stdlib/abort.c:73:17
#10 0x000000082d485e21 (/lib/libc.so.7+0x98e21)
#11 0x00000000038b367b BuildDelegatingInitializer /usr/src/contrib/llvm-project/clang/lib/Sema/SemaDeclCXX.cpp:4443:5
#12 0x00000000038b2e49 BuildBaseInitializer /usr/src/contrib/llvm-project/clang/lib/Sema/SemaDeclCXX.cpp:4525:14
#13 0x00000000038b19fc BuildMemInitializer /usr/src/contrib/llvm-project/clang/lib/Sema/SemaDeclCXX.cpp:0:0
#14 0x00000000038b204d /usr/src/contrib/llvm-project/clang/lib/Sema/SemaDeclCXX.cpp:4115:1
#15 0x000000000356345c ParseMemInitializer /usr/src/contrib/llvm-project/clang/lib/Parse/ParseDeclCXX.cpp:3770:20
#16 0x00000000035628fb ParseConstructorInitializer /usr/src/contrib/llvm-project/clang/lib/Parse/ParseDeclCXX.cpp:3634:29
#17 0x00000000034ec7d8 is /usr/src/contrib/llvm-project/clang/include/clang/Lex/Token.h:97:49
#18 0x00000000034ec7d8 ParseFunctionDefinition /usr/src/contrib/llvm-project/clang/lib/Parse/Parser.cpp:1366:14
#19 0x000000000353d4d8 ParseDeclGroup /usr/src/contrib/llvm-project/clang/lib/Parse/ParseDecl.cpp:2055:18
#20 0x00000000034eb872 ParseDeclOrFunctionDefInternal /usr/src/contrib/llvm-project/clang/lib/Parse/Parser.cpp:0:10
#21 0x00000000034eb305 ParseDeclarationOrFunctionDefinition /usr/src/contrib/llvm-project/clang/lib/Parse/Parser.cpp:1154:12
#22 0x00000000034ea228 ParseExternalDeclaration /usr/src/contrib/llvm-project/clang/lib/Parse/Parser.cpp:0:12
#23 0x0000000003551be4 ~AttributePool /usr/src/contrib/llvm-project/clang/include/clang/Sema/ParsedAttr.h:770:22
#24 0x0000000003551be4 ~ParsedAttributes /usr/src/contrib/llvm-project/clang/include/clang/Sema/ParsedAttr.h:965:7
#25 0x0000000003551be4 ParseInnerNamespace /usr/src/contrib/llvm-project/clang/lib/Parse/ParseDeclCXX.cpp:247:5
#26 0x000000000355145d Exit /usr/src/contrib/llvm-project/clang/include/clang/Parse/Parser.h:1108:15
#27 0x000000000355145d ParseNamespace /usr/src/contrib/llvm-project/clang/lib/Parse/ParseDeclCXX.cpp:227:18
#28 0x0000000003536cc0 ParseDeclaration /usr/src/contrib/llvm-project/clang/lib/Parse/ParseDecl.cpp:0:0
#29 0x00000000034e9f1c ParseExternalDeclaration /usr/src/contrib/llvm-project/clang/lib/Parse/Parser.cpp:0:3
#30 0x0000000003551be4 ~AttributePool /usr/src/contrib/llvm-project/clang/include/clang/Sema/ParsedAttr.h:770:22
#31 0x0000000003551be4 ~ParsedAttributes /usr/src/contrib/llvm-project/clang/include/clang/Sema/ParsedAttr.h:965:7
#32 0x0000000003551be4 ParseInnerNamespace /usr/src/contrib/llvm-project/clang/lib/Parse/ParseDeclCXX.cpp:247:5
#33 0x000000000355145d Exit /usr/src/contrib/llvm-project/clang/include/clang/Parse/Parser.h:1108:15
#34 0x000000000355145d ParseNamespace /usr/src/contrib/llvm-project/clang/lib/Parse/ParseDeclCXX.cpp:227:18
#35 0x0000000003536cc0 ParseDeclaration /usr/src/contrib/llvm-project/clang/lib/Parse/ParseDecl.cpp:0:0
#36 0x00000000034e9f1c ParseExternalDeclaration /usr/src/contrib/llvm-project/clang/lib/Parse/Parser.cpp:0:3
#37 0x00000000034e85e0 ParseTopLevelDecl /usr/src/contrib/llvm-project/clang/lib/Parse/Parser.cpp:720:10
#38 0x00000000034e2c1d ParseAST /usr/src/contrib/llvm-project/clang/lib/Parse/ParseAST.cpp:157:5
#39 0x0000000002ee9a0f Execute /usr/src/contrib/llvm-project/clang/lib/Frontend/FrontendAction.cpp:971:10
#40 0x0000000002e7e04f getPtr /usr/src/contrib/llvm-project/llvm/include/llvm/Support/Error.h:271:42
#41 0x0000000002e7e04f operator bool /usr/src/contrib/llvm-project/llvm/include/llvm/Support/Error.h:234:16
#42 0x0000000002e7e04f ExecuteAction /usr/src/contrib/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:1036:23
#43 0x0000000002fa6ab6 ExecuteCompilerInvocation /usr/src/contrib/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:263:25
#44 0x0000000002477b75 cc1_main /usr/src/contrib/llvm-project/clang/tools/driver/cc1_main.cpp:248:15
#45 0x00000000024850c5 ExecuteCC1Tool /usr/src/contrib/llvm-project/clang/tools/driver/driver.cpp:317:12
#46 0x0000000002d3a1b7 operator() /usr/src/contrib/llvm-project/clang/lib/Driver/Job.cpp:407:30
#47 0x0000000002d3a1b7 callback_fn<(lambda at /usr/src/contrib/llvm-project/clang/lib/Driver/Job.cpp:407:22)> /usr/src/contrib/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:45:12
#48 0x000000000505fd64 operator() /usr/src/contrib/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:0:12
#49 0x000000000505fd64 RunSafely /usr/src/contrib/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:428:3
#50 0x0000000002d39dc3 Execute /usr/src/contrib/llvm-project/clang/lib/Driver/Job.cpp:407:7
#51 0x0000000002d081e2 ExecuteCommand /usr/src/contrib/llvm-project/clang/lib/Driver/Compilation.cpp:196:15
#52 0x0000000002d08689 ExecuteJobs /usr/src/contrib/llvm-project/clang/lib/Driver/Compilation.cpp:249:13
#53 0x0000000002d1d3ac empty /usr/src/contrib/llvm-project/llvm/include/llvm/ADT/SmallVector.h:73:47
#54 0x0000000002d1d3ac ExecuteCompilation /usr/src/contrib/llvm-project/clang/lib/Driver/Driver.cpp:1617:23
c++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
FreeBSD clang version 14.0.5 (https://github.com/llvm/llvm-project.git llvmorg-14.0.5-0-gc12386ae247c)
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/src-a91ba6.cpp
c++: note: diagnostic msg: /tmp/src-a91ba6.sh
c++: note: diagnostic msg: 

********************
...failed clang-linux.compile.c++ bin.v2/libs/url/build/clang-linux-14/release/pch-off/threading-multi/visibility-hidden/src.o...
----------------------------------------------------------------------

Full build log:
https://people.freebsd.org/~yasu/poudriere/data/logs/bulk/curamd64-default/2023-01-20_14h31m30s/logs/boost-libs-1.81.0.log
Comment 1 Yasuhiro Kimura freebsd_committer freebsd_triage 2023-01-21 03:49:17 UTC
I put source files and scripts to reproduce the issue under https://people.freebsd.org/~yasu/clang-assertion-failure/ .
Comment 2 Dimitry Andric freebsd_committer freebsd_triage 2023-01-21 11:45:20 UTC
I can reproduce the assertion. It also reproduces with a very recent version of clang trunk, so I will have to take some time to reduce the test case to something smaller, and submit the problem upstream.
Comment 3 Dimitry Andric freebsd_committer freebsd_triage 2023-01-21 13:17:53 UTC
Minimized and reported upstream: https://github.com/llvm/llvm-project/issues/60182
Comment 4 Dimitry Andric freebsd_committer freebsd_triage 2023-01-21 18:54:28 UTC
Upstream already had this issue for a while, as https://github.com/llvm/llvm-project/issues/39319, so I marked my issue as a duplicate.

Now that it breaks a recent boost, I hope will get resolved more quickly...
Comment 5 Joseph Mingrone freebsd_committer freebsd_triage 2023-01-25 17:41:04 UTC
While the underlying problem still exists, the port builds again on CURRENT after 3efdfab9.

https://cgit.freebsd.org/ports/commit/?id=3efdfab9b59f2cd00beec5c863820f0057f1cfb3 .
Comment 6 Dimitry Andric freebsd_committer freebsd_triage 2023-01-25 18:56:12 UTC
(In reply to Joseph Mingrone from comment #5)
It would be good to confirm that the resulting boost libraries work as expected, since the assertion failure is really only papered over, as the port disables those. :)
Comment 7 Jan Beich freebsd_committer freebsd_triage 2023-01-25 19:42:41 UTC
(In reply to Dimitry Andric from comment #6)
Does anything in ports use Boost.URL? Simply testing boost-libs consumers (486 total) won't help as that'd exercise unaffected code.

https://www.boost.org/doc/libs/1_81_0/libs/url/doc/html/url/overview.html
Comment 8 Yasuhiro Kimura freebsd_committer freebsd_triage 2023-07-11 06:04:53 UTC
I tried https://reviews.llvm.org/D148474 with base be30fd3ab2e on amd64 and confirmed build of devel/boost-libs finishes successfully.
Comment 9 Yasuhiro Kimura freebsd_committer freebsd_triage 2023-07-11 08:37:12 UTC
(In reply to Yasuhiro Kimura from comment #8)

I coreated following review.

https://reviews.freebsd.org/D40970
Comment 10 Dimitry Andric freebsd_committer freebsd_triage 2023-07-11 16:39:54 UTC
(In reply to Yasuhiro Kimura from comment #8)
There are still some problems with the upstream fix, at least one regression test fails. I would like to wait and see for a bit more.
Comment 11 Yasuhiro Kimura freebsd_committer freebsd_triage 2024-03-21 07:01:42 UTC
I confirmed clang in base system builds devel/boost-libs successfully with base f29af8618bf.