Re: [Chromium-users] Re: Chromium 1.9 second release candidate

Brian Paul <[email protected]> Wed, 24 May 2006 13:31:16 -0600
Newsgroups gmane.comp.graphics.chromium.devel,gmane.comp.graphics.chromium.user
Message-ID <[email protected]>
Eric Sandall wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On Wed, 24 May 2006, Brian Paul wrote:
> 
>> Brian Paul wrote:
>>
>>>
>>> A second release candidate of Chromium 1.9 is ready at
>>> http://chromium.sf.net/beta
>>>
>>> This just accumulates a few more bugs fixes since the first RC.
>>
>>
>> I haven't seen any feedback on this, positive or negative.
>>
>> It would be good to at least have a couple people confirm that they're 
>> tried
>> it and it's OK.
>>
>> Thanks.
> 
> 
> Trying to compile cr-1.9rc2 gives:
> $ make
> ...
> Compiling state_program.c
> cc1: warnings being treated as errors
> state_program.c: In function ‘crStateGetVertexAttribivNV’:
> state_program.c:1042: warning: ‘floatParams[0]’ is used
> uninitialized in this function
> state_program.c:1040: warning: ‘floatParams[1]’ may be used
> uninitialized in this function
> state_program.c:1040: warning: ‘floatParams[2]’ may be used
> uninitialized in this function
> state_program.c:1040: warning: ‘floatParams[3]’ may be used
> uninitialized in this function
> gmake[2]: *** [../built/crstate/Linux/state_program.o] Error 1
> gmake[1]: *** [dep] Error 2
> make: *** [state_tracker.subdir] Error 2
> 
> This is with gcc 4.1.0-3 on Fedora Core 5. If I remove -Werror from
> configs/Linux.mk CXXFLAGS and CFLAGS cr-1.9rc2 compiles (I have not
> tried running it yet).

OK, I actually fixed the same problem in a different function and 
didn't realize there was a second instance of it.

The patch is attached.

-Brian
diff (text/plain, 1.1 KB)
Index: state_program.c
===================================================================
RCS file: /cvsroot/chromium/cr/state_tracker/state_program.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- state_program.c	5 May 2006 18:36:52 -0000	1.9
+++ state_program.c	24 May 2006 19:25:52 -0000	1.10
@@ -985,9 +985,8 @@
 
 void STATE_APIENTRY crStateGetVertexAttribdvNV(GLuint index, GLenum pname, GLdouble *params)
 {
-	 GLfloat floatParams[4];
 	 /* init vars to prevent compiler warnings/errors */
-	 floatParams[0] = floatParams[1] = floatParams[2] = floatParams[3] = 0.0;
+	 GLfloat floatParams[4] = { 0.0, 0.0, 0.0, 0.0 };
 	 crStateGetVertexAttribfvNV(index, pname, floatParams);
 	 params[0] = floatParams[0];
 	 if (pname == GL_CURRENT_ATTRIB_NV) {
@@ -1037,7 +1036,8 @@
 
 void STATE_APIENTRY crStateGetVertexAttribivNV(GLuint index, GLenum pname, GLint *params)
 {
-	 GLfloat floatParams[4];
+	 /* init vars to prevent compiler warnings/errors */
+	 GLfloat floatParams[4] = { 0.0, 0.0, 0.0, 0.0 };
 	 crStateGetVertexAttribfvNV(index, pname, floatParams);
 	 params[0] = (GLint) floatParams[0];
 	 if (pname == GL_CURRENT_ATTRIB_NV) {