Bug 274587
| Summary: | WebKit release build fails in WTF_OVERRIDE_DELETE_FOR_CHECKED_PTR with gcc 14 | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Loïc Yhuel <loic.yhuel> |
| Component: | Platform | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | ggaren, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Local Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Loïc Yhuel
When building WPE in release mode on Fedora 40 (gcc 14.1.1) :
In member function ‘IntegralType WTF::SingleThreadIntegralWrapper<IntegralType>::valueWithoutThreadCheck() const [with IntegralType = unsigned int]’,
inlined from ‘PtrCounterType WTF::CanMakeCheckedPtrBase<StorageType, PtrCounterType>::ptrCountWithoutThreadCheck() const [with StorageType = WTF::SingleThreadIntegralWrapper<unsigned int>; PtrCounterType = unsigned int]’ at webkit/WebKitBuild/WPE/Release/WTF/Headers/wtf/CheckedRef.h:295:51,
inlined from ‘static void WebCore::DeviceMotionController::operator delete(WebCore::DeviceMotionController*, std::destroying_delete_t, size_t)’ at webkit/Source/WebCore/dom/DeviceMotionController.h:40:5,
inlined from ‘virtual WebCore::DeviceMotionController::~DeviceMotionController()’ at webkit/Source/WebCore/dom/DeviceMotionController.h:43:13:
webkit/WebKitBuild/WPE/Release/WTF/Headers/wtf/SingleThreadIntegralWrapper.h:43:59: error: ‘((const WTF::SingleThreadIntegralWrapper<unsigned int>*)this)[2].WTF::SingleThreadIntegralWrapper<unsigned int>::m_value’ is used uninitialized [-Werror=uninitialized]
43 | IntegralType valueWithoutThreadCheck() const { return m_value; }
|
(and many other occurences)
It seems gcc doesn't like the use of member variables after the destructor, and reports it as -Wuninitialized.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Loïc Yhuel
It comes from https://github.com/WebKit/WebKit/pull/27212.
I made a simplied case on https://godbolt.org/z/bqsr4oWcM.
Note that without the ALWAYS_INLINE, gcc 11/12/13 also report the warning (despite the generated code being exactly the same).
I saw a similar thing when trying to disable the warning in WTF_OVERRIDE_DELETE_FOR_CHECKED_PTR, around the object->ptrCountWithoutThreadCheck() call.
It can work, sometimes with the help of an additional ALWAYS_INLINE on valueWithoutThreadCheck.
But there are cases where gcc seems to know the context of the call enough to produce the warning, but without the "inlined from" and without being able to disable the warning from above.
Loïc Yhuel
Pull request: https://github.com/WebKit/WebKit/pull/29087
Radar WebKit Bug Importer
<rdar://problem/129007564>
Vitaly Dyackhov
Pull request: https://github.com/WebKit/WebKit/pull/38795
EWS
Committed 289012@main (18e2b7994ecc): <https://commits.webkit.org/289012@main>
Reviewed commits have been landed. Closing PR #29087 and removing active labels.