Bug 113909 - g++ optimizer (-O2) causes error with template
Summary: g++ optimizer (-O2) causes error with template
Alias: None
Product: Red Hat Raw Hide
Classification: Retired
Component: gcc
Version: 1.0
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: David Lawrence
Depends On:
TreeView+ depends on / blocked
Reported: 2004-01-20 01:04 UTC by William Cohen
Modified: 2007-04-18 17:01 UTC (History)
0 users

Clone Of:
Last Closed: 2004-10-29 08:38:39 UTC

Attachments (Terms of Use)

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).

Note You need to log in before you can comment on or make changes to this bug.