Boost logo

Boost :

Subject: [boost] [config] Compiler defects value-initialization
From: Niels Dekker - address until 2010-10-10 (niels_address_until_2010-10-10_at_[hidden])
Date: 2010-04-19 17:19:39


The Config/trunk regression page currently shows some detailed
information of various compiler defects regarding value-initialization:
http://www.boost.org/development/tests/trunk/developer/config_.html If
anyone wants to have a look at these results, please do so quickly! The
output is from boost_no_complete_value_initialization::test(), which
tests whether a specific compiler should have a new defect macro
defined, BOOST_NO_COMPLETE_VALUE_INITIALIZATION. In a few days, I'm
planning to add this definition to the Boost Config files of those
compilers [Boost #4080], and then the test output will disappear
automatically.

According to the current test results, two compilers do an excellent job
w.r.t. value-initialization: Intel (10.1, 11.0, 11.1) on Mac OS X, and
GCC 4.4.3 (both on Linux and Windows).

Compilers that don't completely do value-initialization include
Microsoft Visual C++ (including msvc-10.0), Borland (including CodeGear
2010), Sun 5.10, and IBM XL V10.1. The MSVC defect was reported back in
2005 [Visual Studio #100744]. I recently reported the
value-initialization defects I encountered on Embarcadero CodeGear
[Embarcadero #83751, #83851] and IBM XL.

The Windows version of Intel 11.1 doesn't do so well either, according
to results from Huang-Vista-x86_32_intel. I still wonder why, because on
Mac OS X, Intel does so well. GCC also has regression failures w.r.t.
value-initialization, but those are only on earlier GCC versions, like
gcc-4.2.4 and gcc-4.3.4. The last GCC bug in this area, AFAIK, [GCC
#30111] was fixed for GCC 4.4.

As far as I have seen, any compiler supports value-initialization of
integers, floating point numbers and pointers correctly. However,
problems occur for structs, classes, and arrays. Objects of those types
may be left partially or entirely uninitialized, when they should have
been value-initialized, depending on the compiler.

I hope to have the test and the defect macro included with Boost 1.44.
Please let me know if you have any comment or question about them.
https://svn.boost.org/svn/boost/trunk/libs/config/test/boost_no_com_value_init.ipp

Kind regards, Niels

   References:

[Boost #4080]
"Various compilers need BOOST_NO_COMPLETE_VALUE_INITIALIZATION",
https://svn.boost.org/trac/boost/ticket/4080

[Visual Studio #100744]
"Value-initialization in new-expression", reported by Pavel Kuznetsov:
https://connect.microsoft.com/VisualStudio/feedback/details/100744

[Embarcadero #83751, #83851]
Two value-initialization bugs I recently reported:
http://qc.embarcadero.com/wc/qcmain.aspx?d=83751
http://qc.embarcadero.com/wc/qcmain.aspx?d=83851

[GCC #30111]
"Value-initialization of POD base class doesn't initialize members",
reported by Jason Merrill:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30111

-- 
Niels Dekker
http://www.xs4all.nl/~nd/dekkerware
Scientific programmer at LKEB, Leiden University Medical Center

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk