public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/31970]  New: g++ compiles incorrect c++ code
@ 2007-05-17 10:43 asp_ at mail dot ru
  2007-05-17 14:47 ` [Bug c++/31970] " bangerth at dealii dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: asp_ at mail dot ru @ 2007-05-17 10:43 UTC (permalink / raw)
  To: gcc-bugs

problem with tamplates, an example of incorrect c++ code is here:

http://mx1.ru/super_example.cpp

std::set<int, node_less> b;
std::set<int>::iterator i = b.begin();

the second line should is incorrect, but compiles well.


-- 
           Summary: g++ compiles incorrect c++ code
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: asp_ at mail dot ru


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/31970] g++ compiles incorrect c++ code
  2007-05-17 10:43 [Bug c++/31970] New: g++ compiles incorrect c++ code asp_ at mail dot ru
@ 2007-05-17 14:47 ` bangerth at dealii dot org
  2007-05-18  7:56 ` asp_ at mail dot ru
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: bangerth at dealii dot org @ 2007-05-17 14:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from bangerth at dealii dot org  2007-05-17 15:46 -------
The link you give doesn't work. Can you attach your testcase?
W.


-- 

bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bangerth at dealii dot org
             Status|UNCONFIRMED                 |WAITING


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/31970] g++ compiles incorrect c++ code
  2007-05-17 10:43 [Bug c++/31970] New: g++ compiles incorrect c++ code asp_ at mail dot ru
  2007-05-17 14:47 ` [Bug c++/31970] " bangerth at dealii dot org
@ 2007-05-18  7:56 ` asp_ at mail dot ru
  2007-05-18 10:33 ` [Bug libstdc++/31970] " pcarlini at suse dot de
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: asp_ at mail dot ru @ 2007-05-18  7:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from asp_ at mail dot ru  2007-05-18 08:56 -------
Have you received correct link?

http://mx1.ru/~asp/super_example.cpp

Also I've sent email with file attached. Did you receive it?

(In reply to comment #1)
> The link you give doesn't work. Can you attach your testcase?
> W.
> 


-- 


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libstdc++/31970] g++ compiles incorrect c++ code
  2007-05-17 10:43 [Bug c++/31970] New: g++ compiles incorrect c++ code asp_ at mail dot ru
  2007-05-17 14:47 ` [Bug c++/31970] " bangerth at dealii dot org
  2007-05-18  7:56 ` asp_ at mail dot ru
@ 2007-05-18 10:33 ` pcarlini at suse dot de
  2007-05-18 10:33 ` pcarlini at suse dot de
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pcarlini at suse dot de @ 2007-05-18 10:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pcarlini at suse dot de  2007-05-18 11:33 -------
Yes, that's right, the issue dates back to the original HP / SGI design:
certainly isn't something we can fix without breaking binary compatibility. In
short, it's because _Rb_tree_iterator is templatized only on _Tp.


-- 

pcarlini at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
          Component|c++                         |libstdc++
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-05-18 11:33:02
               date|                            |


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libstdc++/31970] g++ compiles incorrect c++ code
  2007-05-17 10:43 [Bug c++/31970] New: g++ compiles incorrect c++ code asp_ at mail dot ru
                   ` (2 preceding siblings ...)
  2007-05-18 10:33 ` [Bug libstdc++/31970] " pcarlini at suse dot de
@ 2007-05-18 10:33 ` pcarlini at suse dot de
  2007-05-18 10:45 ` pcarlini at suse dot de
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pcarlini at suse dot de @ 2007-05-18 10:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pcarlini at suse dot de  2007-05-18 11:33 -------
Suspending until the next ABI...


-- 

pcarlini at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |SUSPENDED


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libstdc++/31970] g++ compiles incorrect c++ code
  2007-05-17 10:43 [Bug c++/31970] New: g++ compiles incorrect c++ code asp_ at mail dot ru
                   ` (3 preceding siblings ...)
  2007-05-18 10:33 ` pcarlini at suse dot de
@ 2007-05-18 10:45 ` pcarlini at suse dot de
  2007-05-21 15:49 ` [Bug libstdc++/31970] set<>::iterator vs type-safety pcarlini at suse dot de
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pcarlini at suse dot de @ 2007-05-18 10:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pcarlini at suse dot de  2007-05-18 11:45 -------
Note that this is only a Quality of Implementation issue, cannot be considered
a bug, because the type of set::iterator is implementation defined in the
standard, and must only conform to the general requirements in 23.1, must be a
bidirectional iterator.


-- 


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libstdc++/31970] set<>::iterator vs type-safety
  2007-05-17 10:43 [Bug c++/31970] New: g++ compiles incorrect c++ code asp_ at mail dot ru
                   ` (4 preceding siblings ...)
  2007-05-18 10:45 ` pcarlini at suse dot de
@ 2007-05-21 15:49 ` pcarlini at suse dot de
  2007-06-10  0:10 ` chris at bubblescope dot net
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pcarlini at suse dot de @ 2007-05-21 15:49 UTC (permalink / raw)
  To: gcc-bugs



-- 

pcarlini at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |enhancement


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libstdc++/31970] set<>::iterator vs type-safety
  2007-05-17 10:43 [Bug c++/31970] New: g++ compiles incorrect c++ code asp_ at mail dot ru
                   ` (5 preceding siblings ...)
  2007-05-21 15:49 ` [Bug libstdc++/31970] set<>::iterator vs type-safety pcarlini at suse dot de
@ 2007-06-10  0:10 ` chris at bubblescope dot net
  2007-06-10  0:20 ` pcarlini at suse dot de
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: chris at bubblescope dot net @ 2007-06-10  0:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from chris at bubblescope dot net  2007-06-10 00:10 -------
While fixing this could stop that illegal code, wouldn't it also lead to
increased code size where you have multiple sets of (for example) ints
templated on different comparitors?


-- 

chris at bubblescope dot net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |chris at bubblescope dot net


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libstdc++/31970] set<>::iterator vs type-safety
  2007-05-17 10:43 [Bug c++/31970] New: g++ compiles incorrect c++ code asp_ at mail dot ru
                   ` (6 preceding siblings ...)
  2007-06-10  0:10 ` chris at bubblescope dot net
@ 2007-06-10  0:20 ` pcarlini at suse dot de
  2007-06-10  8:57 ` chris at bubblescope dot net
  2010-02-13  1:44 ` paolo dot carlini at oracle dot com
  9 siblings, 0 replies; 11+ messages in thread
From: pcarlini at suse dot de @ 2007-06-10  0:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pcarlini at suse dot de  2007-06-10 00:20 -------
That question occured to me too... Now I'm thinking that probably isn't a real
issue assuming good optimizers, as usual. Do you have a practical example?


-- 


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libstdc++/31970] set<>::iterator vs type-safety
  2007-05-17 10:43 [Bug c++/31970] New: g++ compiles incorrect c++ code asp_ at mail dot ru
                   ` (7 preceding siblings ...)
  2007-06-10  0:20 ` pcarlini at suse dot de
@ 2007-06-10  8:57 ` chris at bubblescope dot net
  2010-02-13  1:44 ` paolo dot carlini at oracle dot com
  9 siblings, 0 replies; 11+ messages in thread
From: chris at bubblescope dot net @ 2007-06-10  8:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from chris at bubblescope dot net  2007-06-10 08:57 -------
Hmm.. I thought I did have a good example, I had a function that looked like:

template<typename It>
int count_unique(It begin, It end)
{
  set<typename It::value_type> counter(begin, end);
  return counter.size();
}

But, while you might get multiple copies of this function for each iterator
type, the "work parts" (the building of the set and the call to size()) will be
the same regardless of if this is fixed.

The only good example I can come up with would be if someone decided to build
multiple maps of set::iterators, which I've never wanted to do...


-- 


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libstdc++/31970] set<>::iterator vs type-safety
  2007-05-17 10:43 [Bug c++/31970] New: g++ compiles incorrect c++ code asp_ at mail dot ru
                   ` (8 preceding siblings ...)
  2007-06-10  8:57 ` chris at bubblescope dot net
@ 2010-02-13  1:44 ` paolo dot carlini at oracle dot com
  9 siblings, 0 replies; 11+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-02-13  1:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from paolo dot carlini at oracle dot com  2010-02-13 01:44 -------
Actually, this is a feature, not a bug:

  http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2913.pdf


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|SUSPENDED                   |RESOLVED
         Resolution|                            |INVALID


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2010-02-13  1:44 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-17 10:43 [Bug c++/31970] New: g++ compiles incorrect c++ code asp_ at mail dot ru
2007-05-17 14:47 ` [Bug c++/31970] " bangerth at dealii dot org
2007-05-18  7:56 ` asp_ at mail dot ru
2007-05-18 10:33 ` [Bug libstdc++/31970] " pcarlini at suse dot de
2007-05-18 10:33 ` pcarlini at suse dot de
2007-05-18 10:45 ` pcarlini at suse dot de
2007-05-21 15:49 ` [Bug libstdc++/31970] set<>::iterator vs type-safety pcarlini at suse dot de
2007-06-10  0:10 ` chris at bubblescope dot net
2007-06-10  0:20 ` pcarlini at suse dot de
2007-06-10  8:57 ` chris at bubblescope dot net
2010-02-13  1:44 ` paolo dot carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).