Bug 268402
| Summary: | JSC fails to build using --jsc-only on Linux | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Asumu Takikawa <asumu> |
| Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Asumu Takikawa
Currently on Linux a --jsc-only build fails like this:
```
In file included from /home/asumu/WebKit/Source/JavaScriptCore/bytecode/CallLinkInfoBase.h:31,
from /home/asumu/WebKit/Source/JavaScriptCore/bytecode/CallLinkInfoBase.cpp:27,
from /home/asumu/WebKit/WebKitBuild/JSCOnly/Release/JavaScriptCore/DerivedSources/unified-sources/UnifiedSource-f0a787a9-3.cpp:1:
In member function ‘void WTF::BasicRawSentinelNode<T, PassedPtrTraits>::setNext(WTF::BasicRawSentinelNode<T, PassedPtrTraits>*) [with T = JSC::CallLinkInfoBase; PassedPtrTraits = WTF::RawPtrTraits<JSC::CallLinkI
nfoBase>]’,
inlined from ‘void WTF::SentinelLinkedList<T, RawNode>::takeFrom(WTF::SentinelLinkedList<T, RawNode>&) [with T = JSC::CallLinkInfoBase; RawNode = WTF::BasicRawSentinelNode<JSC::CallLinkInfoBase>]’ at /home/a
sumu/WebKit/WebKitBuild/JSCOnly/Release/WTF/Headers/wtf/SentinelLinkedList.h:308:31,
inlined from ‘void JSC::CodeBlock::unlinkOrUpgradeIncomingCalls(JSC::VM&, JSC::CodeBlock*)’ at /home/asumu/WebKit/Source/JavaScriptCore/bytecode/CodeBlock.cpp:2096:25:
/home/asumu/WebKit/WebKitBuild/JSCOnly/Release/WTF/Headers/wtf/SentinelLinkedList.h:61:55: error: storing the address of local variable ‘toBeRemoved’ in ‘*MEM[(struct BasicRawSentinelNode * const &)this_4(D) + 9
6].WTF::BasicRawSentinelNode<JSC::CallLinkInfoBase>::m_next’ [-Werror=dangling-pointer=]
61 | void setNext(BasicRawSentinelNode* next) { m_next = next; }
| ~~~~~~~^~~~~~
In file included from /home/asumu/WebKit/WebKitBuild/JSCOnly/Release/JavaScriptCore/DerivedSources/unified-sources/UnifiedSource-f0a787a9-3.cpp:7:
/home/asumu/WebKit/Source/JavaScriptCore/bytecode/CodeBlock.cpp: In member function ‘void JSC::CodeBlock::unlinkOrUpgradeIncomingCalls(JSC::VM&, JSC::CodeBlock*)’:
/home/asumu/WebKit/Source/JavaScriptCore/bytecode/CodeBlock.cpp:2095:82: note: ‘toBeRemoved’ declared here
2095 | SentinelLinkedList<CallLinkInfoBase, BasicRawSentinelNode<CallLinkInfoBase>> toBeRemoved;
| ^~~~~~~~~~~
/home/asumu/WebKit/Source/JavaScriptCore/bytecode/CodeBlock.cpp:2095:82: note: ‘((WTF::BasicRawSentinelNode<JSC::CallLinkInfoBase, WTF::RawPtrTraits<JSC::CallLinkInfoBase> >* const*)this)[12]’ declared here
In member function ‘void WTF::BasicRawSentinelNode<T, PassedPtrTraits>::setPrev(WTF::BasicRawSentinelNode<T, PassedPtrTraits>*) [with T = JSC::CallLinkInfoBase; PassedPtrTraits = WTF::RawPtrTraits<JSC::CallLinkI
nfoBase>]’,
```
The build failure started with commit 65c8acc4699947d9a9b6326b9672a2fca5804a8c and it's because a use of `takeFrom` for `SentinelLinkedList` was added using a stack-allocated temp list.
This causes a dangling pointer warning because temporarily the list that's in the class field will be linked to the temp list while the handover happens. I believe it's ok to ignore this warning because at the end of `takeFrom`, the list is re-linked into the temp list and the other list is reset to the sentinel and the dangling pointers are gone (but GCC cannot tell, I guess).
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Asumu Takikawa
Pull request: https://github.com/WebKit/WebKit/pull/23531
EWS
Committed 273815@main (54c72ceeb7d7): <https://commits.webkit.org/273815@main>
Reviewed commits have been landed. Closing PR #23531 and removing active labels.
Radar WebKit Bug Importer
<rdar://problem/121991236>
Asumu Takikawa
Since the patch landed, I'll leave a comment here that one of my colleagues pointed out this is a bug in GCC that's fixed in GCC 13. Either way the workaround is needed to get this to build in toolchains people are using right now (but noting this for the future).