public inbox for bzip2-devel@sourceware.org
 help / color / mirror / Atom feed
From: "email at arsoftware dot net.br" <sourceware-bugzilla@sourceware.org>
To: bzip2-devel@sourceware.org
Subject: [Bug bzip2/28904] libbzip2: ‘cost[3]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
Date: Tue, 31 May 2022 19:06:56 +0000	[thread overview]
Message-ID: <bug-28904-11876-BGODfd91ka@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-28904-11876@http.sourceware.org/bugzilla/>

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.

      parent reply	other threads:[~2022-05-31 19:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-18  3:18 [Bug bzip2/28904] New: " demerphq at gmail dot com
2022-04-19 22:04 ` [Bug bzip2/28904] " mark at klomp dot org
2022-04-19 22:23 ` mark at klomp dot org
2022-04-20  1:57 ` demerphq at gmail dot com
2022-05-26 20:53 ` mark at klomp dot org
2022-05-31 19:06 ` email at arsoftware dot net.br [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-28904-11876-BGODfd91ka@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=bzip2-devel@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).