From a947a9bcd46bb0248911187a68354b4c695d6c5d Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Fri, 13 Jan 2023 03:41:37 +0100 Subject: Ignore a spurious -Wuse-after-free by GCC GCC 13 seems to have a false positive here: In copy constructor 'QSharedPointer::QSharedPointer(const QSharedPointer&) [with T = const QQmlJSScope]', inlined from 'QDeferredSharedPointer::QDeferredSharedPointer(QSharedPointer) [with T = const QQmlJSScope]' at QQmlJSScope.cpp:33:11, inlined from 'Data::ConstPtr Data::get() const' at QQmlJSScope.cpp:244:37: /home/peppe/p/src/qt5/qtbase/build/include/QtCore/../../../src/corelib/tools/qsharedpointer_impl.h:296:80: warning: pointer used after 'void operator delete(void*)' [-Wuse-after-free] In static member function 'static void QtSharedPointer::ExternalRefCountData::operator delete(void*)', inlined from 'QWeakPointer::~QWeakPointer() [with T = const QQmlJSScope]' at /home/peppe/p/src/qt5/qtbase/build/include/QtCore/../../../src/corelib/tools/qsharedpointer_impl.h:543:60, inlined from 'QWeakPointer::~QWeakPointer() [with T = const QQmlJSScope]' at /home/peppe/p/src/qt5/qtbase/build/include/QtCore/../../../src/corelib/tools/qsharedpointer_impl.h:543:12, inlined from 'QSharedPointer QDeferredWeakPointer::toStrongRef() const [with T = const QQmlJSScope]' at QQmlJSScope.cpp:186:16, inlined from 'Data::ConstPtr Data::get() const' at QQmlJSScope.cpp:244:36: /home/peppe/p/src/qt5/qtbase/build/include/QtCore/../../../src/corelib/tools/qsharedpointer_impl.h:130:67: note: call to 'void operator delete(void*)' here This makes qtdeclarative FTBFS in release builds. Change-Id: If7a7565a68a7eaa0770c41e4e7ad1288b460e7ef Reviewed-by: Ulf Hermann (cherry picked from commit 1d72f21415609ce7a8b665a71776d7ac26f1d4ee) Reviewed-by: Qt Cherry-pick Bot --- src/qmlcompiler/qqmljsscope_p.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/qmlcompiler/qqmljsscope_p.h b/src/qmlcompiler/qqmljsscope_p.h index 127d58abcc..f5b0c4aedb 100644 --- a/src/qmlcompiler/qqmljsscope_p.h +++ b/src/qmlcompiler/qqmljsscope_p.h @@ -303,7 +303,12 @@ public: QQmlJSScope::ConstPtr parentScope() const { +QT_WARNING_PUSH +#if defined(Q_CC_GNU_ONLY) && Q_CC_GNU < 1400 + QT_WARNING_DISABLE_GCC("-Wuse-after-free") +#endif return QQmlJSScope::WeakConstPtr(m_parentScope).toStrongRef(); +QT_WARNING_POP } static void reparent(const QQmlJSScope::Ptr &parentScope, const QQmlJSScope::Ptr &childScope); -- cgit v1.2.3