[Webkit-unassigned] [Bug 280710] New: Fix uninitialized value warnings reported by GCC 14

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Oct 1 14:37:44 PDT 2024


https://bugs.webkit.org/show_bug.cgi?id=280710

            Bug ID: 280710
           Summary: Fix uninitialized value warnings reported by GCC 14
           Product: WebKit
           Version: Other
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebCore Misc.
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: mcatanzaro at redhat.com

This one is surely a real bug, and straightforward enough to fix:

[226/2507] Building CXX object Source/WebCore/CMakeFiles/WebCore.dir/__/__/WebCore/DerivedSources/unified-sources/UnifiedSource-3a52ce78-8.cpp.o
In file included from /home/mcatanzaro/Projects/WebKit/WebKitBuild/gtk4/WebCore/DerivedSources/unified-sources/UnifiedSource-3a52ce78-8.cpp:3:
/home/mcatanzaro/Projects/WebKit/WebKitBuild/gtk4/WebCore/DerivedSources/JSAudioWorkletNodeOptions.cpp: In function ‘WebCore::ConversionResult<WebCore::IDLDictionary<T> > WebCore::convertDictionary(JSC::JSGlobalObject&, JSC::JSValue) [with T = AudioWorkletNodeOptions]’:
/home/mcatanzaro/Projects/WebKit/WebKitBuild/gtk4/WebCore/DerivedSources/JSAudioWorkletNodeOptions.cpp:58:29: warning: ‘*(WTF::VectorBuffer<unsigned int, 0, WTF::FastMalloc>*)((char*)&result + offsetof(WebCore::AudioWorkletNodeOptions, WebCore::AudioWorkletNodeOptions::outputChannelCount.std::optional<WTF::Vector<unsigned int, 0, WTF::CrashOnOverflow, 16, WTF::FastMalloc> >::<unnamed>.std::_Optional_base<WTF::Vector<unsigned int, 0, WTF::CrashOnOverflow, 16, WTF::FastMalloc>, false, false>::<unnamed>)).WTF::VectorBuffer<unsigned int, 0, WTF::FastMalloc>::WTF::VectorBufferBase<unsigned int, WTF::FastMalloc>.WTF::VectorBufferBase<unsigned int, WTF::FastMalloc>::m_capacity’ is used uninitialized [-Wuninitialized]
   58 |     AudioWorkletNodeOptions result;
      |                             ^~~~~~
/home/mcatanzaro/Projects/WebKit/WebKitBuild/gtk4/WebCore/DerivedSources/JSAudioWorkletNodeOptions.cpp:58:29: warning: ‘*(WTF::VectorBuffer<unsigned int, 0, WTF::FastMalloc>*)((char*)&result + offsetof(WebCore::AudioWorkletNodeOptions, WebCore::AudioWorkletNodeOptions::outputChannelCount.std::optional<WTF::Vector<unsigned int, 0, WTF::CrashOnOverflow, 16, WTF::FastMalloc> >::<unnamed>.std::_Optional_base<WTF::Vector<unsigned int, 0, WTF::CrashOnOverflow, 16, WTF::FastMalloc>, false, false>::<unnamed>)).WTF::VectorBuffer<unsigned int, 0, WTF::FastMalloc>::WTF::VectorBufferBase<unsigned int, WTF::FastMalloc>.WTF::VectorBufferBase<unsigned int, WTF::FastMalloc>::m_size’ is used uninitialized [-Wuninitialized]

Then there's a bunch of warnings about CheckedRef. I think these surely must be false positives:

In file included from /home/mcatanzaro/Projects/WebKit/WebKitBuild/gtk4/WTF/Headers/wtf/CheckedRef.h:33,
                 from /home/mcatanzaro/Projects/WebKit/WebKitBuild/gtk4/WTF/Headers/wtf/CheckedPtr.h:28,
                 from /home/mcatanzaro/Projects/WebKit/WebKitBuild/gtk4/WTF/Headers/wtf/Hasher.h:25,
                 from /home/mcatanzaro/Projects/WebKit/Source/WebCore/css/parser/CSSParserContext.h:33,
                 from /home/mcatanzaro/Projects/WebKit/WebKitBuild/gtk4/WebCore/DerivedSources/CSSPropertyParsing.cpp:6,
                 from /home/mcatanzaro/Projects/WebKit/WebKitBuild/gtk4/WebCore/DerivedSources/unified-sources/UnifiedSource-3a52ce78-1.cpp:1:
In member function ‘IntegralType WTF::SingleThreadIntegralWrapper<IntegralType>::valueWithoutThreadCheck() const [with IntegralType = unsigned int]’,
    inlined from ‘PtrCounterType WTF::CanMakeCheckedPtrBase<StorageType, PtrCounterType, defaultedOperatorEqual>::ptrCountWithoutThreadCheck() const [with StorageType = WTF::SingleThreadIntegralWrapper<unsigned int>; PtrCounterType = unsigned int; WTF::DefaultedOperatorEqual defaultedOperatorEqual = WTF::DefaultedOperatorEqual::No]’ at /home/mcatanzaro/Projects/WebKit/WebKitBuild/gtk4/WTF/Headers/wtf/CheckedRef.h:297:51,
    inlined from ‘static void WebCore::HTMLUnknownElement::operator delete(WebCore::HTMLUnknownElement*, std::destroying_delete_t, size_t)’ at /home/mcatanzaro/Projects/WebKit/Source/WebCore/html/HTMLUnknownElement.h:38:5,
    inlined from ‘virtual WebCore::HTMLUnknownElement::~HTMLUnknownElement()’ at /home/mcatanzaro/Projects/WebKit/Source/WebCore/html/HTMLUnknownElement.h:36:7:
/home/mcatanzaro/Projects/WebKit/WebKitBuild/gtk4/WTF/Headers/wtf/SingleThreadIntegralWrapper.h:43:59: warning: ‘((const WTF::SingleThreadIntegralWrapper<unsigned int>*)this)[6].WTF::SingleThreadIntegralWrapper<unsigned int>::m_value’ is used uninitialized [-Wuninitialized]
   43 |     IntegralType valueWithoutThreadCheck() const { return m_value; }
      |                                                           ^~~~~~~

I have tried several things but all have failed, so I think we should just suppress this one. It seems clearly impossible for m_value to be uninitialized unless uninitialized data is passed to the SingleThreadIntegralWrapper constructor. But CanMakeCheckedPtr will always pass 0 (because CanMakeCheckedPtrBase's m_count is always initialized to 0).

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20241001/a63e4b7d/attachment.htm>


More information about the webkit-unassigned mailing list