Patchwork [c++] : Fix possible uninitialized variable

login
register
mail settings
Submitter Kai Tietz
Date July 14, 2010, 10:26 a.m.
Message ID <AANLkTimEXaWjIOlkUzkeSq_Knr_uSM0P1cn_h9qCknf-@mail.gmail.com>
Download mbox | patch
Permalink /patch/58862/
State New
Headers show

Comments

Kai Tietz - July 14, 2010, 10:26 a.m.
Hi,

ChangeLog

2010-07-14  Kai Tietz

          * method.c (synthesized_method_walk): Initialize
          check_vdtor by false.

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

Regards,
Kai
Paolo Carlini - July 14, 2010, 11:52 a.m.
On 07/14/2010 12:26 PM, Kai Tietz wrote:
> Hi,
>
> ChangeLog
>
> 2010-07-14  Kai Tietz
>
>           * method.c (synthesized_method_walk): Initialize
>           check_vdtor by false.
>
> Tested for i686-pc-linux-gnu, i686-pc-mingw32, and x86_64-pc-mingw32.
> Ok for apply?
>   
Frankly, I do not understand why you are proposing this change: at line
1007 check_vdtor is assigned false and there are no uses whatsoever
before. Everything seems fine, and, by the way, the case of assign_p is
quite similar. Are you seeing spurious warnings during the bootstrap?

Paolo.
Jakub Jelinek - July 14, 2010, 11:58 a.m.
On Wed, Jul 14, 2010 at 01:52:20PM +0200, Paolo Carlini wrote:
> On 07/14/2010 12:26 PM, Kai Tietz wrote:
> > 2010-07-14  Kai Tietz
> >
> >           * method.c (synthesized_method_walk): Initialize
> >           check_vdtor by false.
> >
> > Tested for i686-pc-linux-gnu, i686-pc-mingw32, and x86_64-pc-mingw32.
> > Ok for apply?
> >   
> Frankly, I do not understand why you are proposing this change: at line
> 1007 check_vdtor is assigned false and there are no uses whatsoever
> before. Everything seems fine, and, by the way, the case of assign_p is
> quite similar. Are you seeing spurious warnings during the bootstrap?

That's because Jason fixed this yesterday:
http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162159
Before that it has been really uninitialized.

	Jakub
Kai Tietz - July 14, 2010, 12:14 p.m.
2010/7/14 Jakub Jelinek <jakub@redhat.com>:
> On Wed, Jul 14, 2010 at 01:52:20PM +0200, Paolo Carlini wrote:
>> On 07/14/2010 12:26 PM, Kai Tietz wrote:
>> > 2010-07-14  Kai Tietz
>> >
>> >           * method.c (synthesized_method_walk): Initialize
>> >           check_vdtor by false.
>> >
>> > Tested for i686-pc-linux-gnu, i686-pc-mingw32, and x86_64-pc-mingw32.
>> > Ok for apply?
>> >
>> Frankly, I do not understand why you are proposing this change: at line
>> 1007 check_vdtor is assigned false and there are no uses whatsoever
>> before. Everything seems fine, and, by the way, the case of assign_p is
>> quite similar. Are you seeing spurious warnings during the bootstrap?
>
> That's because Jason fixed this yesterday:
> http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162159
> Before that it has been really uninitialized.
>
>        Jakub
>

Ah, he did this patch already. Ok, so this patch is obsolete. I
reported it yesterday to jason and wasn't sure if he already fixed it,
so I posted it today.

Kai
Jason Merrill - July 14, 2010, 1:25 p.m.
On 07/14/2010 08:14 AM, Kai Tietz wrote:
> Ah, he did this patch already.

Yep, sorry I didn't say I would take care of it.  Thanks.

Jason

Patch

Index: method.c
===================================================================
--- method.c    (revision 162168)
+++ method.c    (working copy)
@@ -941,7 +941,7 @@ 
                         bool diag)
 {
   tree binfo, base_binfo, field, scope, fnname, rval, argtype;
-  bool move_p, copy_arg_p, assign_p, expected_trivial, check_vdtor;
+  bool move_p, copy_arg_p, assign_p, expected_trivial, check_vdtor = false;
   VEC(tree,gc) *vbases;
   int i, quals, flags;
   tsubst_flags_t complain;