[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2] bunzip: work around gcc13 warning
- To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Mon, 13 Mar 2023 15:10:23 +0100
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=v8ZfVvF/xyDxSOUC9NMxxnc9ml2ayEDDK2L8jfWTChE=; b=iZr/w9pMPxbXM+W1mbL96Zb4d8Tnxy8FbTX0mlcwLVpn57FmPbEG0kiYWDWFkX9YE6SO4/i1VLciWtv1ZhGMSOmJlMxehC9Aywc3m7X1BZ1FXWi9EumGv6ntRiRawXxRCNZ4hzgWUGUC8Icuqik8oj2GKr2zgNADMM5o2xlZqq0opw4fk4i1KSKohiHOd3XnEqq7dVSS7KlbMktRnm7cTUdcdMTEVtCS5a6OXWVz2ihCzh+ZiJG3vivoWYb15enxBp2Eu6wVugIwBikzTDeAEk31vcXwh4Ovsr7sAW+4nfFJlO5l8Px4ni6CDL/44D4ufwnmwddEv0ve0fXY55MXFw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KkyY1VJtrgh/406jok2tZIKwvZUFuqt41LOoVnPoj3xnrrvoyh7i+btDN83pu0aie1hVKwSjTXpLc4tM8CUmYgOOyiIeT4gmODiYij2FhZSa9MhrXVMJf2XnI+f3AliZHgy4DUxQaKv10K0n9nSJVl4TPsBU6AwVHGUt4LRN0H0Dsojvgh4WbGAGYF5f1SGjkKdVNL/NYtr8bww5ekOIWYy+2HfJpwc3mEH1bLr555C0FZRFubWCUfitC2Gmg2RvVlJby81IOKbhflaOKA950F/DsGhqgGgN2rtyQ4GTycOo+izNzjKlagnx477fTOW7D/LE8mNvAKXLPhyAgtamZQ==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
- Delivery-date: Mon, 13 Mar 2023 14:10:55 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
While provable that length[0] is always initialized (because symCount
cannot be zero), upcoming gcc13 fails to recognize this and warns about
the unconditional use of the value immediately following the loop.
See also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106511.
Reported-by: Martin Liška <martin.liska@xxxxxxxx>
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
v2: Put new code on a separate line and add comment.
---
RFC: We've cloned this code from Linux and the code is unchanged there.
Therefore the same issue should exist there, and we may better get
whatever workaround is going to be applied there. But I'm unaware
of the issue, so far, having been observed in and reported against
Linux. This may be because they disable the maybe-uninitialized
warning by default, and they re-enable it only when building with
W=2.
--- a/xen/common/bunzip2.c
+++ b/xen/common/bunzip2.c
@@ -233,6 +233,11 @@ static int __init get_next_block(struct
becomes negative, so an unsigned inequality catches
it.) */
t = get_bits(bd, 5)-1;
+ /* GCC 13 has apparently improved use-before-set detection, but
+ it can't figure out that length[0] is always intialized by
+ virtue of symCount always being positive when making it here.
+ See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106511. */
+ length[0] = 0;
for (i = 0; i < symCount; i++) {
for (;;) {
if (((unsigned)t) > (MAX_HUFCODE_BITS-1))
|