From c81a9e4ed6a9d667e1d0ff4687416ee19860e0d0 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 17 Nov 2023 15:49:25 +0100 Subject: [PATCH] QProcess: work around GCC 13 -Wmaybe-uninitialized in -unity-build When in a unity-build GCC 13 sees the implementation of forkfd_wait4(), called dfrom forkfd_wait(), it can prove that there are paths that do not initialize *info: Those paths are the returns following fcntl() in system_forkfs_wait() in forkd_linux.c and read() in forkfd_wait4(). To work around the issue and unbreak unity-builds, initialize info = {}. Task-number: QTBUG-119081 Change-Id: I1b3504e7f83c766ebccc851233d4c3e677bf2acd Reviewed-by: Thiago Macieira (cherry picked from commit 635774fc324f079a41e2cecbcfdb700bf171ab6c) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit 6710ec26de221522f0e68d2b50c8d5ee05488361) --- src/corelib/io/qprocess_unix.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index efeb81fb80d..ccf261d2de9 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -902,7 +902,8 @@ void QProcessPrivate::waitForDeadChild() Q_ASSERT(forkfd != -1); // read the process information from our fd - forkfd_info info; + forkfd_info info = {}; // Silence -Wmaybe-uninitialized; Thiago says forkfd_wait cannot fail here + // (QTBUG-119081) int ret; EINTR_LOOP(ret, forkfd_wait(forkfd, &info, nullptr));