public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix uninitialized variables
@ 2021-11-08 11:18 Michał Kotyla
  0 siblings, 0 replies; only message in thread
From: Michał Kotyla @ 2021-11-08 11:18 UTC (permalink / raw)
  To: systemtap; +Cc: piotr.krol, tomasz.zyjewski

Hello,

in Yocto or any other build system which uses 
"-Werror=maybe-uninitialized" flag, there is a problem while SystemTap 
is building. Initialization "this_column_size" and "num" variables as 
bellow fix this problem.

 From efca812046fa43ba778ebb4b065325b63b9c2b78 Mon Sep 17 00:00:00 2001 
From: =?UTF-8?q?Micha=C5=82=20Kotyla?= <michal.kotyla@3mdeb.com> Date: 
Mon, 8 Nov 2021 10:06:15 +0100 Subject: [PATCH] bpf-translate.cxx: 
Initialize variables 'num' and 'this_column_size' MIME-Version: 1.0 
Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 
Signed-off-by: Michał Kotyla <michal.kotyla@3mdeb.com> --- 
bpf-translate.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 
deletions(-) diff --git a/bpf-translate.cxx b/bpf-translate.cxx index 
3f45c721f..956f09d00 100644 --- a/bpf-translate.cxx +++ 
b/bpf-translate.cxx @@ -1203,7 +1203,7 @@ bpf_unparser::emit_asm_arg 
(const asm_stmt &stmt, const std::string &arg, { /* arg is a register 
number */ std::string reg = arg[0] == 'r' ? arg.substr(1) : arg; - 
unsigned long num; + unsigned long num = 0; bool parsed = false; try { 
num = stoul(reg, 0, 0); @@ -1943,7 +1943,7 @@ 
bpf_unparser::visit_foreach_loop(foreach_loop* s) auto type = 
arraydecl->index_types[k]; if (type != pe_long && type != pe_string) 
throw SEMANTIC_ERROR(_("unhandled foreach index type"), s->tok); - int 
this_column_size; + int this_column_size = 0; // PR23875: foreach should 
handle string keys if (type == pe_long) { -- 2.25.1

Best regards,

-- 
Michał Kotyla
Embedded Linux Developer
GPG: 14FC54DC259CF70A
https://3mdeb.com | @3mdeb_com


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-08 11:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-08 11:18 [PATCH] Fix uninitialized variables Michał Kotyla

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).