Bug 135586 - xglx-050705-5: 2 * local variable used before set
Summary: xglx-050705-5: 2 * local variable used before set
Status: RESOLVED FIXED
Alias: None
Product: SUSE LINUX 10.0
Classification: openSUSE
Component: Basesystem (show other bugs)
Version: Final
Hardware: All SuSE Linux 10.0
: P5 - None : Minor
Target Milestone: ---
Assignee: Matthias Hopf
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-26 12:08 UTC by David Binderman
Modified: 2005-11-29 15:29 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 2005-11-26 12:08:28 UTC
I just tried to compile package xglx-050705-5 with a GNU C compiler

It said

1.

fbbits.h:829: warning: "bits" is used uninitialized in this function

The source code is

    bits += bitsStride * yoff + xoff * MUL;

I have read the source code, and I agree with the compiler. 
Suggest initialise local variable "bits" before first use.

2.

../../GL/mesa/src/mesa/shader/slang/slang_assemble_constructor.c:267: warning: "master_rows" is used uninitialized in this function

The source code is

        for (i = 0; i < master_rows; i++)

I have read the source code, and I agree with the compiler. 
Suggest initialise local variable "master_rows" before first use.
Comment 1 Matthias Hopf 2005-11-29 15:29:47 UTC
(In reply to comment #0)
> fbbits.h:829: warning: "bits" is used uninitialized in this function
> I have read the source code, and I agree with the compiler. 
> Suggest initialise local variable "bits" before first use.

Actually, bits is never used before initialized. So this unitialized variable had no bad side effect. I nuked that line, thanks!

Note that this will not show up in the xglx package any more, as it is superseeded by the xgl package that will be shipped beginning with SL 10.1.
The code base has changed pretty much as well...

> ../../GL/mesa/src/mesa/shader/slang/slang_assemble_constructor.c:267: warning:
> "master_rows" is used uninitialized in this function

I would agree with *may* be used unitialized, but not with *is*.
However, master_spec->type has to be one of the switch cases, the default section could even have an abort() AFAICS.

> I have read the source code, and I agree with the compiler. 

I don't. It typically is initialized. One should code safe, though.
As this is still present in the current Mesa sources, this could be filed as a bug for upstream Mesa development.

However, the function does not seem to do the right thing anyway (/* XXX: wrong */ in the function header). I doubt it is of any use to do something here in the current state the shader assember is in.