From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qv1-xf2d.google.com (mail-qv1-xf2d.google.com [IPv6:2607:f8b0:4864:20::f2d]) by sourceware.org (Postfix) with ESMTPS id D5E713858D20 for ; Thu, 17 Feb 2022 16:49:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D5E713858D20 Received: by mail-qv1-xf2d.google.com with SMTP id f19so9394828qvb.6 for ; Thu, 17 Feb 2022 08:49:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=EM1lBlH/JMK8MwvhcBTMyzd3Q4yNO2kZcO1LgLO6PLw=; b=6OAlFlx2JJgyqa/x8S8PR3TwNvrklRvKpxzhaJXbZUSLM9XY0DAXaRgF2h13vDCj3q 4Qk8wl8nQIb5RbwEAiTmOj6ucfMQo2IqoSYWpdlTEX9umr8WhJYoDBw87egx9vLpMl28 pCQqGChIDDWpefP29F7RWGmtgPQir65elYcbPyMo+qF8R/kSzbvPmeMFzynYMZcONhXl WTTpgKG+PjS9x+ow+HbCFlwBbfVW3B2I1CxaWmQocxv4TJam5oeMpEGacd5k1OV95i6a jowr5XXUHy2ODBC0CCXifCPeoxCEw6ryxFPIXYwHLYHnAQyAGbppWwtJgh5F8n7ihpCc Rrng== X-Gm-Message-State: AOAM532/E+cGMol4/19kjZE+DD6yd2U2hW94tgY3mckyIVg/YDYTC/9r t9f6v5oKhnijAgdTsuuX5GanhbDDWrM/FfrhwON7Jbf+K0Ckhw== X-Google-Smtp-Source: ABdhPJyEzo79+ttV+/lxy+5cKhHLm2r2d9Wzu7mbcI5exeAw9Q2IbOq+r0EzKYUMNzQ8vWvnEsrutbdpcuATtCeeMaA= X-Received: by 2002:a05:6214:5295:b0:425:4291:a18a with SMTP id kj21-20020a056214529500b004254291a18amr2590366qvb.54.1645116571340; Thu, 17 Feb 2022 08:49:31 -0800 (PST) MIME-Version: 1.0 From: demerphq Date: Thu, 17 Feb 2022 17:49:19 +0100 Message-ID: Subject: Silence uninitialized compiler warnings in libbzip2 To: bzip2-devel@sourceware.org Cc: Paul Marquess , reply+AAAZ5R647Q4LBXPAWPTVYZOADILK5EVBNHHEH72XRI@reply.github.com X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: bzip2-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Bzip2-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Feb 2022 16:49:34 -0000 Hi, I am a contributor to the Perl project. https://github.com/Perl/perl5 We bundle your library libbzip2 via the perl Module Compress-Raw-Bzip2, which is hosted at: https://github.com/pmqs/Compress-Raw-Bzip2 We are trying to ensure our builds are warning clean, however when building this package your library produces "may be used uninitialized" warnings on some compilers, you can see these warnings below. While this is almost certainly a false positive warning, it is also trivial to silence the warnings with essentially no performance hit by initializing the cost structure with 0's at the start. We have an open bug report for this for perl here: https://github.com/Perl/perl5/issues/19432 And an open bug report for this for the module here: https://github.com/pmqs/Compress-Raw-Bzip2/issues/4 And a patch for it here: https://github.com/pmqs/Compress-Raw-Bzip2/pull/5/commits/641a440ec6229c1d3= 68b9ead48f4968b955c0115 The maintainer of Compress-Raw-Bzip2 (on CC) is known to prefer not to apply changes to this library code that are not upstream. (A reasonable policy.) I was wondering if you could apply this patch, or something equivalent that would fix this so that the perl project could have warning free builds. Your library is the last module we ship that produces warnings during the build process. We target a wide range of compilers and try to keep our code as clean as possible, and while again I accept that your code likely is not buggy as you initialize it in a loop at line 357, 357: for (t =3D 0; t < nGroups; t++) cost[t] =3D 0; as far as I can tell nGroups is not a constant, and the compiler reasonably cannot be certain that all BZ_N_GROUPS entries in the array are initialized before use. We in the perl development community would appreciate it if you would release a patch that would silence these warnings for us. Then Paul could roll a new release of his module, and we in the Perl could then use that and be happy with a completely warning free build. gcc -c -I. -D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=3D64 -Wall -Werror=3Dpointer-arith -Werror=3Dvla -Wextra -Wno-long-long -Wno-declaration-after-statement -Wc++-compat -Wwrite-strings -O3 -DVERSION=3D\"2.101\" -DXS_VERSION=3D\"2.101\" -fPIC "-I../.." -Wall -Wno-comment -DBZ_NO_STDIO compress.c compress.c: In function =E2=80=98BZ2_compressBlock=E2=80=99: compress.c:392:54: warning: =E2=80=98cost[5]=E2=80=99 may be used uninitial= ized in this function [-Wmaybe-uninitialized] for (t =3D 0; t < nGroups; t++) cost[t] +=3D s->len[t][icv]= ; ^~ compress.c:256:11: note: =E2=80=98cost[5]=E2=80=99 was declared here UInt16 cost[BZ_N_GROUPS]; ^~~~ compress.c:402:21: warning: =E2=80=98cost[3]=E2=80=99 may be used uninitial= ized in this function [-Wmaybe-uninitialized] if (cost[t] < bc) { bc =3D cost[t]; bt =3D t; }; ~~~~^~~ compress.c:256:11: note: =E2=80=98cost[3]=E2=80=99 was declared here UInt16 cost[BZ_N_GROUPS]; ^~~~ compress.c:402:21: warning: =E2=80=98cost[2]=E2=80=99 may be used uninitial= ized in this function [-Wmaybe-uninitialized] if (cost[t] < bc) { bc =3D cost[t]; bt =3D t; }; ~~~~^~~ compress.c:256:11: note: =E2=80=98cost[2]=E2=80=99 was declared here UInt16 cost[BZ_N_GROUPS]; ^~~~ Your consideration on this matter would be much appreciated. I have requested an account with your bug tracker and will file a formal ticket as soon as I get an account. Thank you very much for your time in producing this library, I personally have made use of it many times in my career. cheers, Yves --=20 perl -Mre=3Ddebug -e "/just|another|perl|hacker/"