RESOLVED FIXED274587
WebKit release build fails in WTF_OVERRIDE_DELETE_FOR_CHECKED_PTR with gcc 14
https://bugs.webkit.org/show_bug.cgi?id=274587
Summary WebKit release build fails in WTF_OVERRIDE_DELETE_FOR_CHECKED_PTR with gcc 14
Loïc Yhuel
Reported 2024-05-23 08:46:38 PDT
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
Loïc Yhuel
Comment 1 2024-05-23 08:48:26 PDT
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
Comment 2 2024-05-24 14:56:56 PDT
Radar WebKit Bug Importer
Comment 3 2024-05-30 08:47:11 PDT
Vitaly Dyackhov
Comment 4 2025-01-09 09:04:55 PST
EWS
Comment 5 2025-01-16 08:09:24 PST
Committed 289012@main (18e2b7994ecc): <https://commits.webkit.org/289012@main> Reviewed commits have been landed. Closing PR #29087 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.