From 635774fc324f079a41e2cecbcfdb700bf171ab6c 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 Pick-to: 6.6 6.5 Change-Id: I1b3504e7f83c766ebccc851233d4c3e677bf2acd Reviewed-by: Thiago Macieira --- 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 361b28dcff1..69c2ec73ccb 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -1253,7 +1253,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));