Bug 113909

Summary: g++ optimizer (-O2) causes error with template
Product: [Retired] Red Hat Raw Hide Reporter: William Cohen <wcohen>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 1.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-10-29 08:38:39 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description William Cohen 2004-01-20 01:04:50 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030922

Description of problem:
g++ fails to generate executable code when -O2 is use, but g++ will
generate code when code is unoptimized. The arrange_profile.ii
available from ftp://people.redhat.com/wcohen/arrange_profiles.ii

following command line works (no optimization):
g++   -g   -c -o arrange_profiles.o arrange_profiles.ii

following fails with optimization:
g++   -g -O2   -c -o arrange_profiles.o arrange_profiles.ii
/usr/include/c++/3.3.2/bits/stl_function.h: In member function `bool
   std::less<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp =
/usr/include/c++/3.3.2/bits/stl_tree.h:1042:   instantiated from
`std::pair<std::_Rb_tree_iterator<_Val, _Val&, _Val*>, bool>
std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare,
_Alloc>::insert_unique(const _Val&) [with _Key = profile_class, _Val =
profile_class, _KeyOfValue = std::_Identity<profile_class>, _Compare =
std::less<profile_class>, _Alloc = std::allocator<profile_class>]'
/usr/include/c++/3.3.2/bits/stl_set.h:155:   instantiated from
`std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Key>,
_Compare, _Alloc>::const_iterator, bool> std::set<_Key, _Compare,
_Alloc>::insert(const _Key&) [with _Key = profile_class, _Compare =
std::less<profile_class>, _Alloc = std::allocator<profile_class>]'
arrange_profiles.cpp:340:   instantiated from here
/usr/include/c++/3.3.2/bits/stl_function.h:197: error: no match for
   in '__x < __y'

Version-Release number of selected component (if applicable):
gcc-c++-3.3.2-5 libstdc++-devel-3.3.2-1

How reproducible:

Steps to Reproduce:
Look at the description above

Actual Results:  Failure listed above.

Expected Results:  Compiles successfully with -O2

Additional info:

The original source code is OProfile cvs (2004/01/19),

Comment 1 Jakub Jelinek 2004-10-29 08:38:39 UTC
Works with g++ 3.4.2 (after replacing the preprocessed STL includes
with #include directives).