Multiple unreferenced symbols (allocator_arg, piecewise_construct) in executable that uses STL - by Miro Jakubovsky

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


2
0
Sign in
to vote
ID 820750 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 2/21/2014 2:02:22 AM
Access Restriction Public

Description

There are multiple unreferenced variables named allocator_arg and piecewise_construct in resulting executable if project uses STL.
These are only C++ helpers and they are really not referenced anywhere in binary. Moreover it seems that there is one instance of such variables per .cpp file that uses STL.

I believe this is caused by these definitions of allocator_arg and piecewise_construct in standard header files:

const allocator_arg_t allocator_arg = allocator_arg_t();

const piecewise_construct_t piecewise_construct =
    piecewise_construct_t();

This causes that every time STL header is included new instances of const variables are created. The question is why linker is not able to remove those variables from executable.
Sign in to post a comment.
Posted by Miro Jakubovsky on 10/31/2014 at 4:35 AM
Hello,

I just wanted to let you know that I've tested it with VS14 CTP4 and it seems to be fixed.
So, thank you (and you can probably close this issue).
Posted by Microsoft on 3/19/2014 at 5:58 PM
Hi,

Thanks for reporting this bug. We've already fixed it, and the fix will be available in the next major version of VC.

We've changed the compiler and the STL to avoid emitting unused machinery into object files, including allocator_arg and piecewise_construct. Notably, this can dramatically reduce object file sizes. For example, a translation unit including all STL headers and doing nothing else, compiled for x86 with /MD /O2, produced a 731 KB object file with VC 2013. With our current development build, the object file has shrunk to 2,663 bytes.

Stephan T. Lavavej
Senior Developer - Visual C++ Libraries
stl@microsoft.com
Posted by Microsoft on 2/23/2014 at 11:08 PM
Your issue has been routed to the appropriate VS development team for review. We will contact you if we require any additional information. If you require immediate assistance with this issue, please contact product support at http://support.microsoft.com/ph/1117.
Posted by Microsoft on 2/21/2014 at 2:50 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)