Re: gcc 6.1.0 bogus placement new warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/26/2016 08:28 PM, Jason Mancini wrote:
It seems if you have an array of pointers, and attempt:

   object* TheArray[2];
   TheArray[x] = (object*) malloc(NUM * sizeof(object));
   new (TheArray[x] + num) object(...);

The check uses size of TheArray (16 bytes), and not the large allocation
which TheArray[x] points to.  Known bug?  Easy to work around with a
temp variable at least.

error: placement new constructing an object of type '...' and size '120'
in a region of type 'object* [2] {...* [2]}' and size at most '16'
[-Werror=placement-new=]

It does look like a new problem.  I raised bug 71306 for it.

Thanks
Martin




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux