Patchwork [soft-fp] : Possibly use of uninitialized variables

login
register
mail settings
Submitter Kai Tietz
Date Oct. 18, 2010, 11:14 a.m.
Message ID <AANLkTim_J3RgwO2ixQQ=XkPuwNsJr64aRHC2ruEHcM0v@mail.gmail.com>
Download mbox | patch
Permalink /patch/68168/
State New
Headers show

Comments

Kai Tietz - Oct. 18, 2010, 11:14 a.m.
Hello,

This fixes some potential uses of unitialized variables, which I got
reported by gcc 3.4.4 while bootstrap and it seems right by its
detection.

ChangeLog

2010-10-18  Kai Tietz

        * config/soft-fp/op-common.h (_FP_DECL): Initialize
        variable by zero.

Tested for x86_64-w64-mingw32, and i686-pc-mingw32. Ok for apply?

Regards,
Kai
Joseph S. Myers - Oct. 18, 2010, 11:50 a.m.
On Mon, 18 Oct 2010, Kai Tietz wrote:

> Hello,
> 
> This fixes some potential uses of unitialized variables, which I got
> reported by gcc 3.4.4 while bootstrap and it seems right by its
> detection.

Please see codingconventions.html.  soft-fp patches must always go in 
glibc first with unmodified glibc code then being imported into GCC.

In this case, see <http://sourceware.org/bugzilla/show_bug.cgi?id=10114> - 
you'll need to work out a fix on the lines of what the last comment 
indicates.

This code should never be built with 3.4.4 anyway; it's target code that 
should only be built by the newly built compiler.
Kai Tietz - Oct. 18, 2010, 12:46 p.m.
gcc-patches-owner@gcc.gnu.org wrote on 18.10.2010 13:50:43:

> On Mon, 18 Oct 2010, Kai Tietz wrote:
> 
> > Hello,
> > 
> > This fixes some potential uses of unitialized variables, which I got
> > reported by gcc 3.4.4 while bootstrap and it seems right by its
> > detection.
> 
> Please see codingconventions.html.  soft-fp patches must always go in 
> glibc first with unmodified glibc code then being imported into GCC.
> 
> In this case, see <http://sourceware.org/bugzilla/show_bug.cgi?id=10114> 
- 
> you'll need to work out a fix on the lines of what the last comment 
> indicates.

Well, I see that this problem is already addressed for a year.  I have to 
admit that soft-fp build for targets, which aren't based on glibc, is a 
bit loud due unprototyped functions and some potential uninitialized 
variables, but all in all nothing serious.  So I am patient that this 
latent issues get fixed on glibc.

> This code should never be built with 3.4.4 anyway; it's target code that 

> should only be built by the newly built compiler.

Yes, sorry for being unclear here. Of course warning is shown by produced 
4.6 based compiler.


> -- 
> Joseph S. Myers
> joseph@codesourcery.com
> 

Regards,
Kai

Patch

Index: op-common.h
===================================================================
--- op-common.h (revision 165609)
+++ op-common.h (working copy)
@@ -31,7 +31,7 @@ 
    MA 02110-1301, USA.  */

 #define _FP_DECL(wc, X)                                                \
-  _FP_I_TYPE X##_c __attribute__((unused)), X##_s, X##_e;      \
+  _FP_I_TYPE X##_c __attribute__((unused)), X##_s = 0, X##_e = 0;      \
   _FP_FRAC_DECL_##wc(X)

 /*