]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Clear entire "location" in value constructor
authorTom Tromey <tom@tromey.com>
Tue, 10 Apr 2018 14:24:43 +0000 (08:24 -0600)
committerTom Tromey <tom@tromey.com>
Fri, 25 May 2018 19:53:09 +0000 (13:53 -0600)
My recent change to allocate values with "new" may have introduced a
small bug.  In particular, the previous code allocated with XCNEW, but
the new code only clears a part of the "location" field in the
constructor.  I didn't try very hard to actually trigger a bug here,
the problem remains theoretical.

This patch just arranges to initialize the entire location.

Regression tested by the buildbot.

2018-05-25  Tom Tromey  <tom@tromey.com>

* value.c (value::location): Initialize.

gdb/ChangeLog
gdb/value.c

index 4f087b1e196d018457a5435ebe5caf2dc4de0aaa..33c6a712a869d0d95f5b31af1adcc2570d4879d4 100644 (file)
@@ -1,3 +1,7 @@
+2018-05-25  Tom Tromey  <tom@tromey.com>
+
+       * value.c (value::location): Initialize.
+
 2018-05-25  Tom Tromey  <tom@tromey.com>
 
        * dbxread.c (init_bincl_list): Remove.
index aa6ca43b414646ec0ac7e956160641cf5240c2d7..6bb6b8eb61ebfe5509d9a423643d124772a1fb14 100644 (file)
@@ -180,7 +180,6 @@ struct value
       type (type_),
       enclosing_type (type_)
   {
-    location.address = 0;
   }
 
   ~value ()
@@ -262,7 +261,7 @@ struct value
       /* Closure for those functions to use.  */
       void *closure;
     } computed;
-  } location;
+  } location {};
 
   /* Describes offset of a value within lval of a structure in target
      addressable memory units.  Note also the member embedded_offset