Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 155330 - local variable used before set
local variable used before set
Product: Fedora
Classification: Fedora
Component: kdegraphics (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Ngo Than
Depends On:
  Show dependency treegraph
Reported: 2005-04-19 04:45 EDT by David Binderman
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-07-27 11:02:08 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description David Binderman 2005-04-19 04:45:15 EDT
Description of problem:

I just tried to compile kdegraphics-3.4.0-2 from Redhat
Fedora Core development tree

The compiler said

kpcursorlightcross.cpp:75: warning: 'colorValue' is used uninitialized in this

The source code is

    if (colorValue)

I agree with the compiler. Suggest initialise colorValue before first use.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
Actual results:

Expected results:

Additional info:
Comment 1 Ngo Than 2005-07-27 11:02:08 EDT
i have taken a look here. The code looks sane for me!

    int colorValue, maskValue;

    switch (pv)
    case White:
        colorValue = ColorWhite;
        maskValue = MaskOpaque;

    case Black:
        colorValue = ColorBlack;
        maskValue = MaskOpaque;

    case Transparent:
        colorValue = ColorWhite;
        maskValue = MaskTransparent;

    if (colorValue)
Comment 2 David Binderman 2005-07-27 18:24:13 EDT
>The code looks sane for me!

I'm guessing why you think that.

Maybe you think that there is default initialisation of local variables
to zero in C or maybe that pv can take only one of three values ?

In either case, I still strongly recommend initialisation of colorValue
*before* the switch statement is evaluated. 

switch statements have a nasty habit of having none of the cases executed.

Note You need to log in before you can comment on or make changes to this bug.