[Bug target/59207] New: config/sparc/sparc.c:10663: possible uninit local variable ?

dcb314 at hotmail dot com gcc-bugzilla@gcc.gnu.org
Wed Nov 20 08:53:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59207

            Bug ID: 59207
           Summary: config/sparc/sparc.c:10663: possible uninit local
                    variable ?
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com

I just ran the static analyser over the trunk source code.

It said

[trunk/gcc/config/sparc/sparc.c:10663]: (error) Uninitialized variable:
neg2_ovf

Source code is

          bool neg1_ovf, neg2_ovf, add1_ovf, add2_ovf;

          tmp = e1.neg_with_overflow (&neg1_ovf);
          tmp = e0.add_with_sign (tmp, false, &add1_ovf);
          if (tmp.is_negative ())
        tmp = tmp.neg_with_overflow (&neg2_ovf);

          result = result.add_with_sign (tmp, false, &add2_ovf);
          overflow |= neg1_ovf | neg2_ovf | add1_ovf | add2_ovf;

Since neg2_ovf is only conditionally initialised, suggest initialise
at its declaration. Like

          bool neg1_ovf, neg2_ovf = false, add1_ovf, add2_ovf;



More information about the Gcc-bugs mailing list