From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.groups.io with SMTP id smtpd.web10.20455.1585163335586291832 for ; Wed, 25 Mar 2020 12:08:55 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=G4cNveac; spf=pass (domain: redhat.com, ip: 63.128.21.74, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585163334; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=757r4TBe3nwmPiKvjybb5sEk3LN8r/85xC3Tm+/PX/Y=; b=G4cNveac4TTkAWtR+hOuVOas6jJNXEHHg0Tr/EztVVW9KM4u/nimtFyE298h0P/oC7Vc5J V0GWhrfCQULhndh6PnrzidtrqM59Gi6SMHPuF56WRIl/4ctzBk4l0atn1jE+3wyFNWy7gT v66HlueUXM6A1aYNW7zTOd+yW6nPZOY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-288-CWJVh4WIOIeW1xzMWoWvAw-1; Wed, 25 Mar 2020 15:08:50 -0400 X-MC-Unique: CWJVh4WIOIeW1xzMWoWvAw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 199508010EE; Wed, 25 Mar 2020 19:08:49 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-153.ams2.redhat.com [10.36.113.153]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7E99C5DA84; Wed, 25 Mar 2020 19:08:48 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH] OvmfPkg/X86QemuLoadImageLib: add dummy assignment to work around GCC To: devel@edk2.groups.io, ard.biesheuvel@linaro.org References: <20200325091238.24048-1-ard.biesheuvel@linaro.org> From: "Laszlo Ersek" Message-ID: Date: Wed, 25 Mar 2020 20:08:47 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20200325091238.24048-1-ard.biesheuvel@linaro.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 03/25/20 10:12, Ard Biesheuvel wrote: > GCC 4.8 or 4.9 may throw the following error when building OVMF: >=20 > Edk2/OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.c: > In function =E2=80=98QemuLoadKernelImage=E2=80=99: > Edk2/OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.c:416:30: > error: =E2=80=98CommandLine=E2=80=99 may be used uninitialized in t= his function > [-Werror=3Dmaybe-uninitial= ized] > UnicodeSPrintAsciiFormat ( > cc1: all warnings being treated as errors >=20 > This is due to the fact that older GCCs fail to infer that CommandLine is > never actually used unless it has been assigned. So add a redundant NULL > assignment to help these older GCCs understand this. >=20 > Link: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2630 > Fixes: 7c47d89003a6f ("OvmfPkg: implement QEMU loader library for X86 wit= h ...") > Signed-off-by: Ard Biesheuvel > --- > OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.c | 5 +++++ > 1 file changed, 5 insertions(+) >=20 > diff --git a/OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.c b/= OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.c > index c5bd6862b265..52b14a4462d8 100644 > --- a/OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.c > +++ b/OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.c > @@ -291,6 +291,11 @@ QemuLoadKernelImage ( > CHAR8 *CommandLine; > UINTN InitrdSize; > =20 > + // > + // Redundant assignment to work around GCC48/GCC49 limitations. > + // > + CommandLine =3D NULL; > + > // > // Load the image. This should call back into the QEMU EFI loader file= system. > // >=20 Reviewed-by: Laszlo Ersek Thanks, Laszlo