[Bug other/32508] New: g++ emits concept checks instantiations (code size blows up).

pluto at agmk dot net gcc-bugzilla@gcc.gnu.org
Mon Jun 25 21:54:00 GMT 2007


according to documentation of libstdc++:

"--enable-concept-checks
 This turns on additional compile-time checks for instantiated library
 templates, in the form of specialized templates, described here.
 They can help users discover when they break the rules of the STL,
 before their programs run."

in fact, gcc 4.1.x emits concept checks instatiations and drastically
increase code size. gcc 4.2 works fine.

testcase:

#include <vector>
struct X { };
std::vector< X > foo()
{
        std::vector< X > v;
        v.resize( 8 );
        return v;
}

$ g++41 concepts.cpp -o concepts-41.so -shared -O2 -fpic -s

$ readelf -sW concepts-41.so|grep Concept|c++filt
     6: 00000000000014b0    31 FUNC    WEAK   DEFAULT   10
__gnu_cxx::_LessThanComparableConcept<unsigned long>::__constraints()
    11: 00000000000015d0     2 FUNC    WEAK   DEFAULT   10
__gnu_cxx::_DefaultConstructibleConcept<__gnu_cxx::__normal_iterator<X*,
std::vector<X, std::allocator<X> > > >::__constraints()
    12: 0000000000001570     5 FUNC    WEAK   DEFAULT   10
__gnu_cxx::_BidirectionalIteratorConcept<__gnu_cxx::__normal_iterator<X*,
std::vector<X, std::allocator<X> > > >::__constraints()
    14: 0000000000001600     2 FUNC    WEAK   DEFAULT   10
__gnu_cxx::_TrivialIteratorConcept<__gnu_cxx::__normal_iterator<X*,
std::vector<X, std::allocator<X> > > >::__constraints()
    15: 00000000000015f0     5 FUNC    WEAK   DEFAULT   10
__gnu_cxx::_OutputIteratorConcept<__gnu_cxx::__normal_iterator<X*,
std::vector<X, std::allocator<X> > >, X>::__constraints()
    16: 00000000000014e0     2 FUNC    WEAK   DEFAULT   10
__gnu_cxx::_ConvertibleConcept<std::random_access_iterator_tag,
std::input_iterator_tag>::__constraints()
    17: 00000000000015c0     2 FUNC    WEAK   DEFAULT   10
__gnu_cxx::_ConvertibleConcept<std::random_access_iterator_tag,
std::forward_iterator_tag>::__constraints()
    19: 00000000000015a0    31 FUNC    WEAK   DEFAULT   10
__gnu_cxx::_EqualityComparableConcept<__gnu_cxx::__normal_iterator<X*,
std::vector<X, std::allocator<X> > > >::__constraints()
    20: 0000000000001580     2 FUNC    WEAK   DEFAULT   10
__gnu_cxx::_AssignableConcept<__gnu_cxx::__normal_iterator<X*, std::vector<X,
std::allocator<X> > > >::__constraints()
    21: 0000000000001500     2 FUNC    WEAK   DEFAULT   10
__gnu_cxx::_ConvertibleConcept<X, X>::__constraints()
    24: 00000000000014f0     5 FUNC    WEAK   DEFAULT   10
__gnu_cxx::_InputIteratorConcept<__gnu_cxx::__normal_iterator<X*,
std::vector<X, std::allocator<X> > > >::__constraints()
    26: 0000000000001590     2 FUNC    WEAK   DEFAULT   10
__gnu_cxx::_ConvertibleConcept<std::random_access_iterator_tag,
std::bidirectional_iterator_tag>::__constraints()
    31: 0000000000001620     4 FUNC    WEAK   DEFAULT   10
__gnu_cxx::_Mutable_BidirectionalIteratorConcept<__gnu_cxx::__normal_iterator<X*,
std::vector<X, std::allocator<X> > > >::__constraints()
    33: 0000000000001610     4 FUNC    WEAK   DEFAULT   10
__gnu_cxx::_Mutable_ForwardIteratorConcept<__gnu_cxx::__normal_iterator<X*,
std::vector<X, std::allocator<X> > > >::__constraints()
    37: 00000000000015e0     2 FUNC    WEAK   DEFAULT   10
__gnu_cxx::_ForwardIteratorConcept<__gnu_cxx::__normal_iterator<X*,
std::vector<X, std::allocator<X> > > >::__constraints()


-- 
           Summary: g++ emits concept checks instantiations (code size blows
                    up).
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pluto at agmk dot net
GCC target triplet: x86_64-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32508



More information about the Gcc-bugs mailing list