Fix off-by-one storage problem in irange_allocator.
authorAldy Hernandez <aldyh@redhat.com>
Tue, 6 Oct 2020 06:21:56 +0000 (08:21 +0200)
committerAldy Hernandez <aldyh@redhat.com>
Tue, 6 Oct 2020 07:35:03 +0000 (09:35 +0200)
gcc/ChangeLog:

* value-range.h (irange_allocator::allocate): Increase
newir storage by one.

gcc/value-range.h

index 94b48e55e778cd6842ee080b7c55fa260ac64801..7031a8231383671f57e7be174a8cdf1d8e014f0d 100644 (file)
@@ -670,7 +670,7 @@ irange_allocator::allocate (unsigned num_pairs)
 
   struct newir {
     irange range;
-    tree mem[1];
+    tree mem[2];
   };
   size_t nbytes = (sizeof (newir) + sizeof (tree) * 2 * (num_pairs - 1));
   struct newir *r = (newir *) obstack_alloc (&m_obstack, nbytes);