[Bug bzip2/28904] libbzip2: ‘cost[3]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
mark at klomp dot org
sourceware-bugzilla@sourceware.org
Thu May 26 20:53:44 GMT 2022
https://sourceware.org/bugzilla/show_bug.cgi?id=28904
Mark Wielaard <mark at klomp dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #4 from Mark Wielaard <mark at klomp dot org> ---
(In reply to demerphq from comment #3)
> I am fine with both of your proposals. I was wondering why you don't
> use memset() instead of the explicit loop? From what I understand it
> is faster.
I went with the second option. I am not using memset but let the compiler pick
the most efficient way of initializing. With just 6 elements calling memcpy
might just be extra overhead. Thanks for the report.
commit 9de658d248f9fd304afa3321dd7a9de1280356ec
Author: Mark Wielaard <mark@klomp.org>
Date: Thu May 26 22:38:01 2022 +0200
Initialize the fave and cost arrays fully
We try to be smart in sendMTFValues by initializing just nGroups
number of elements instead of all BZ_N_GROUPS elements. But this means
the compiler doesn't know all elements are correctly initialized and
might warn. The arrays are really small, BZ_N_GROUPS, 6 elements. And
nGroups == BZ_N_GROUPS is the common case. So just initialize them all
always. Using a constant loop might also help the compiler to optimize
the initialization.
https://sourceware.org/bugzilla/show_bug.cgi?id=28904
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Bzip2-devel
mailing list