- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Not sure if this is the correct place to report what seems to be a compiler bug, but here goes:
While icc have embraced the C++14 variants of operator delete, it seems to pass an incorrect value for the size parameter.
Reproduction case as an example on Compiler Explorer, where the incorrect assembly is also observable: https://godbolt.org/g/pPWktV
The second parameter, "the std::size_t size argument must equal the size argument passed to the allocation function that returned ptr." -18.6.1.2 Array forms [new.delete.array], item 12. Right now the compiler seems to pass the size of a single object instead of the size of the entire allocation.
This was initially discovered using the Scudo Hardened Allocator: https://llvm.org/docs/ScudoHardenedAllocator.html
Feel free to ask for additional information.
Cheers,
Daniel
x64-64 icc 18.0.0, -O3 -std=c++14
#include <cstdint> struct A { A() { m_single = new uint16_t; // Calls operator new(2) m_array = new uint16_t[16384]; // Calls operator new[](32768) } ~A() { delete m_single; // Calls (C++14) operator delete(m_single, 2) delete[] m_array; // Incorrectly calls (C++14) operator delete[](m_array, 2) // Should call (C++14) operator delete[](m_array, 32768) or operator delete[](m_array) } uint16_t *m_single; uint16_t *m_array; }; A a;
- Tags:
- CC++
- Development Tools
- Intel® C++ Compiler
- Intel® Parallel Studio XE
- Intel® System Studio
- Optimization
- Parallel Computing
- Vectorization
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Daniel,
It looks like 18.0.3 has addressed the problem (see attached screenshot).
Please let us know if the issue still persists.
vahoang@orcsle147:/tmp$ icc -V
Intel(R) C Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 18.0.3.222 Build 20180410
Copyright (C) 1985-2018 Intel Corporation. All rights reserved.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page