[Bug bzip2/28904] libbzip2: ‘cost[3]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
email at arsoftware dot net.br
sourceware-bugzilla@sourceware.org
Tue May 31 19:06:56 GMT 2022
https://sourceware.org/bugzilla/show_bug.cgi?id=28904
--- Comment #5 from email at arsoftware dot net.br ---
Need to check the code
Wait...
Thanks
Em 19 de abr. de 2022 19:04, mark at klomp dot org via Bzip2-devel
<bzip2-devel@sourceware.org> escreveu:
https://sourceware.org/bugzilla/show_bug.cgi?id=28904
Mark Wielaard <mark at klomp dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2022-04-19
Ever confirmed|0 |1
CC| |mark at klomp dot org
--- Comment #1 from Mark Wielaard <mark at klomp dot org> ---
Sorry for the late reply.
I think you are right that initializing these two small (6 ints)
arrays at the
start of the function is fine if it helps the compiler.
I haven't been able to reproduce the compiler warning myself
though.
My proposed patch would be:
diff --git a/compress.c b/compress.c
index 5dfa002..c825c78 100644
--- a/compress.c
+++ b/compress.c
@@ -253,8 +253,8 @@ void sendMTFValues ( EState* s )
--*/
- UInt16 cost[BZ_N_GROUPS];
- Int32 fave[BZ_N_GROUPS];
+ UInt16 cost[BZ_N_GROUPS] = { 0 };
+ Int32 fave[BZ_N_GROUPS] = { 0 };
UInt16* mtfv = s->mtfv;
{ 0 } initializes the whole array with zero, so we don't have to
know the exact
number of elements.
Does the above work for you?
--
You are receiving this mail because:
You are on the CC list for the bug.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Bzip2-devel
mailing list