Bug 155947 - netdiag-20010114-397: local variable used before set
Summary: netdiag-20010114-397: local variable used before set
Status: RESOLVED WONTFIX
Alias: None
Product: SUSE LINUX 10.0
Classification: openSUSE
Component: Basesystem (show other bugs)
Version: unspecified
Hardware: All SuSE Linux 10.1
: P5 - None : Normal
Target Milestone: ---
Assignee: Marcus Rückert
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-07 22:25 UTC by David Binderman
Modified: 2006-03-16 13:28 UTC (History)
0 users

See Also:
Found By: Other
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Binderman 2006-03-07 22:25:44 UTC
I just tried to compile package netdiag-20010114-397 with the Intel C compiler.

It said

tulip-diag.c(891): warning #592: variable "sum" is used before its value is set

The source code is

                        u_int16_t sum;
                        outl(0x600 | i, ioaddr + 0x98);
                        do
                                value = inl(ioaddr + CSR9);
                        while (value < 0  && --boguscnt > 0);
                        ((u_int16_t *)eeprom_contents)[i] = value;
                        sum += value & 0xffff;

I agree with the compiler.  Suggest initialise local variable "sum" 
before first use.
Comment 1 Marcus Rückert 2006-03-16 13:28:58 UTC
the sum variable is only used inside this loop.
gcc doesnt warn about it as it eliminates this variable in the optimizer.
the gcc warnings for uninitialized variables are emitted after this optimization step.

the real fix might be removing the declaration of sum and the one line where it is used. but i would ask upstream about this suggestion first. i dont think it is worth fixing a "non" bug.