Bug#953068: bossa: patch to initialize variables (needed when building with -O3)

Gianfranco Costamagna locutusofborg at debian.org
Sat Nov 12 14:19:28 GMT 2022


Hello,

updated diff attached.
On Tue, 03 Mar 2020 16:17:52 -0800 Steve Langasek <steve.langasek at canonical.com> wrote:
> Package: bossa
> Version: 1.9.1-1
> Severity: minor
> Tags: patch
> User: ubuntu-devel at lists.ubuntu.com
> Usertags: origin-ubuntu focal ubuntu-patch
> 
> Hi Scott,
> 
> In Ubuntu, the latest version of bossa has failed to build on ppc64el
> because the ppc64el architecture in Ubuntu uses -O3 as a default
> optimization, which exposes a number of uninitialized variables in the code.
> 
> In reality none of these variables are used uninitialized, but the compiler
> can't /prove/ that, so it errors out.
> 
> The attached patch fixes this issue by adding initializers to the various
> variables, and has been uploaded to Ubuntu.  Please consider including this
> patch in Debian, and/or forwarding it to upstream.
> 
> Thanks,
> -- 
> Steve Langasek                   Give me a lever long enough and a Free OS
> Debian Developer                   to set it on, and I can move the world.
> Ubuntu Developer                                   https://www.debian.org/
> slangasek at ubuntu.com                                     vorlon at debian.org
-------------- next part --------------
diff -Nru bossa-1.9.1/debian/changelog bossa-1.9.1/debian/changelog
--- bossa-1.9.1/debian/changelog	2022-10-19 01:41:34.000000000 +0200
+++ bossa-1.9.1/debian/changelog	2022-11-08 19:15:04.000000000 +0100
@@ -1,3 +1,10 @@
+bossa (1.9.1-3.1) unstable; urgency=low
+
+   * debian/patches/no-uninitialized-variables.patch: ensure all
+     variables are provably initialized before use. (Closes: #-1)
+
+ -- Steve Langasek <steve.langasek at ubuntu.com>  Tue, 08 Nov 2022 10:15:04 -0800
+
 bossa (1.9.1-3) unstable; urgency=medium
 
   * Team upload.
diff -Nru bossa-1.9.1/debian/patches/no-uninitialized-variables.patch bossa-1.9.1/debian/patches/no-uninitialized-variables.patch
--- bossa-1.9.1/debian/patches/no-uninitialized-variables.patch	1970-01-01 01:00:00.000000000 +0100
+++ bossa-1.9.1/debian/patches/no-uninitialized-variables.patch	2022-11-08 19:15:04.000000000 +0100
@@ -0,0 +1,162 @@
+Description: ensure all variables are provably initialized before use.
+ When compiling with gcc -O3 (as on Ubuntu ppc64el), the compiler notices
+ a number of variables do not have initializers.  While these variables are
+ passed by reference to functions that we know are going to initialize them
+ on success, we add various initializers here anyway to make the compiler
+ happy.
+Author: Steve Langasek <steve.langasek at ubuntu.com>
+Last-Update: 2020-03-03
+
+Index: bossa-1.9.1/src/Command.cpp
+===================================================================
+--- bossa-1.9.1.orig/src/Command.cpp
++++ bossa-1.9.1/src/Command.cpp
+@@ -293,7 +293,7 @@ CommandBod::CommandBod() :
+ void
+ CommandBod::invoke(char* argv[], int argc)
+ {
+-    bool value;
++    bool value = false;
+     
+     if (!argNum(argc, 2) ||
+         !argBool(argv[1], &value) ||
+@@ -320,7 +320,7 @@ CommandBootf::CommandBootf() :
+ void
+ CommandBootf::invoke(char* argv[], int argc)
+ {
+-    bool value;
++    bool value = false;
+     
+     if (!argNum(argc, 2) ||
+         !argBool(argv[1], &value) ||
+@@ -341,7 +341,7 @@ CommandBor::CommandBor() :
+ void
+ CommandBor::invoke(char* argv[], int argc)
+ {
+-    bool value;
++    bool value = false;
+     
+     if (!argNum(argc, 2) ||
+         !argBool(argv[1], &value) ||
+@@ -393,7 +393,7 @@ CommandDebug::CommandDebug() :
+ void
+ CommandDebug::invoke(char* argv[], int argc)
+ {
+-    bool state;
++    bool state = false;
+ 
+     if (!argNum(argc, 2) ||
+         !argState(argv[1], &state))
+@@ -413,8 +413,8 @@ CommandDump::CommandDump() :
+ void
+ CommandDump::invoke(char* argv[], int argc)
+ {
+-    uint32_t addr;
+-    uint32_t count;
++    uint32_t addr = 0;
++    uint32_t count = 0;
+ 
+     if (!argNum(argc, 3) ||
+         !argUint32(argv[1], &addr) ||
+@@ -483,7 +483,7 @@ CommandGo::CommandGo() :
+ void
+ CommandGo::invoke(char* argv[], int argc)
+ {
+-    uint32_t addr;
++    uint32_t addr = 0;
+ 
+     if (!argNum(argc, 2) ||
+         !argUint32(argv[1], &addr) ||
+@@ -588,7 +588,7 @@ CommandMrb::CommandMrb() :
+ void
+ CommandMrb::invoke(char* argv[], int argc)
+ {
+-    uint32_t addr;
++    uint32_t addr = 0;
+     uint32_t count = 1;
+     uint8_t value;
+ 
+@@ -619,8 +619,8 @@ CommandMrf::CommandMrf() :
+ void
+ CommandMrf::invoke(char* argv[], int argc)
+ {
+-    uint32_t addr;
+-    uint32_t count;
++    uint32_t addr = 0;
++    uint32_t count = 0;
+     FILE* infile;
+     uint8_t buf[1024];
+     ssize_t fbytes;
+@@ -669,7 +669,7 @@ CommandMrw::CommandMrw() :
+ void
+ CommandMrw::invoke(char* argv[], int argc)
+ {
+-    uint32_t addr;
++    uint32_t addr = 0;
+     uint32_t count = 1;
+     uint32_t value;
+ 
+@@ -700,8 +700,8 @@ CommandMwb::CommandMwb() :
+ void
+ CommandMwb::invoke(char* argv[], int argc)
+ {
+-    uint32_t addr;
+-    uint32_t value;
++    uint32_t addr = 0;
++    uint32_t value = 0;
+ 
+     if (!argRange(argc, 2, 3) ||
+         !argUint32(argv[1], &addr) ||
+@@ -748,7 +748,7 @@ CommandMwf::invoke(char* argv[], int arg) :
+ void
+ CommandMwf::invoke(char* argv[], int argc)
+ {
+-    uint32_t addr;
++    uint32_t addr = 0;
+     FILE* infile;
+     uint8_t buf[1024];
+     ssize_t fsize;
+@@ -803,8 +803,8 @@ CommandMww::CommandMww() :
+ void
+ CommandMww::invoke(char* argv[], int argc)
+ {
+-    uint32_t addr;
+-    uint32_t value;
++    uint32_t addr = 0;
++    uint32_t value = 0;
+ 
+     if (!argRange(argc, 2, 3) ||
+         !argUint32(argv[1], &addr) ||
+@@ -874,11 +874,9 @@ CommandPio::invoke(char* argv[], int arg
+         return;
+     }
+ 
+-    if (argv[1][2] == '\0')
+-    {
+-        line = 0xffffffff;
+-    }
+-    else
++    line = 0xffffffff;
++
++    if (argv[1][2] != '\0')
+     {
+         if (!argUint32(&argv[1][2], &line))
+             return;
+@@ -1062,7 +1060,7 @@ CommandPio::invoke(char* argv[], int arg
+     }
+     else if (strncasecmp(argv[2], "pullup", len) == 0)
+     {
+-        bool state;
++        bool state = false;
+         if (!argNum(argc, 4) ||
+             !argState(argv[3], &state))
+             return;
+@@ -1075,7 +1073,7 @@ CommandPio::invoke(char* argv[], int arg
+     }
+     else if (strncasecmp(argv[2], "multidrive", len) == 0)
+     {
+-        bool state;
++        bool state = false;
+         if (!argNum(argc, 4) ||
+             !argState(argv[3], &state))
+             return;
diff -Nru bossa-1.9.1/debian/patches/series bossa-1.9.1/debian/patches/series
--- bossa-1.9.1/debian/patches/series	2022-10-19 01:34:15.000000000 +0200
+++ bossa-1.9.1/debian/patches/series	2022-11-08 19:15:04.000000000 +0100
@@ -2,3 +2,4 @@
 add-kfreebsd-platform-support.patch
 fix_version.patch
 wx3.2.patch
+no-uninitialized-variables.patch


More information about the debian-science-maintainers mailing list