Project

General

Profile

Actions

Bug #1108

closed

Compiler warning: use of possibly-uninitialized variable

Added by Ricardo Nabinger Sanchez over 7 years ago. Updated almost 5 years ago.

Status:
Invalid
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
05/22/2017
Due date:
% Done:

0%

Estimated time:

Description

master: 76206d8105706488f2bc84ce64f5a126d87c8219

ctf-visitor-generate-io-struct.c: In function 'ctf_visitor_construct_metadata':
ctf-visitor-generate-io-struct.c:2744:16: warning: 'v' may be used uninitialized in this function [-Wmaybe-uninitialized]
    env->vpid = (int) v;
                ^~~~~~~
ctf-visitor-generate-io-struct.c:2733:13: note: 'v' was declared here
    uint64_t v;
             ^

Upon inspecting function get_unary_unsigned in source:formats/ctf/metadata/ctf-visitor-generate-io-struct.c#L183 one can see that if the head list is empty, 0 is returned and value -> v is unchanged. I would propose a patch but I don't feel confident as to what would be a safe default initializer for v prior to calling get_unary_unsigned (zero would be guessing and point to invalid PID).

Actions

Also available in: Atom PDF