public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/34105]  New: [4.3 Regression] Confusing error message with missing #include <algorithm>
@ 2007-11-15  8:57 rguenth at gcc dot gnu dot org
  2007-11-15 11:59 ` [Bug libstdc++/34105] " pcarlini at suse dot de
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-11-15  8:57 UTC (permalink / raw)
  To: gcc-bugs

For

#include <vector>
#include <string>

int main()
{
  std::vector<std::string> x;
  std::string s("hello");
  return std::find(x.begin(), x.end(), s) - x.begin();
}

we now get "interesting" linker errors with trunk:

> g++-4.3 -o t t.C
/tmp/cc3Vq2t8.o: In function `main':
t.C:(.text+0x65): undefined reference to
`__gnu_cxx::__normal_iterator<std::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, std::vector<std::basic_string<char,
std::char_traits<char>, std::allocator<char> >,
std::allocator<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > > > >
std::find<__gnu_cxx::__normal_iterator<std::basic_string<char,
std::char_traits<char>, std::allocator<char> >*,
std::vector<std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, std::allocator<std::basic_string<char,
std::char_traits<char>, std::allocator<char> > > > >, std::basic_string<char,
std::char_traits<char>, std::allocator<char> >
>(__gnu_cxx::__normal_iterator<std::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, std::vector<std::basic_string<char,
std::char_traits<char>, std::allocator<char> >,
std::allocator<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > > > >,
__gnu_cxx::__normal_iterator<std::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, std::vector<std::basic_string<char,
std::char_traits<char>, std::allocator<char> >,
std::allocator<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > > > >, std::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&)'
collect2: ld returned 1 exit status

where it is not exactly obvious that just the #include <algorithm> is missing
here.  With 4.2 and 4.2 at least the program linked fine (I guess algorithm
was pulled in anyway).

Can we improve this situation by not making algorithm half-way available so
we can raise a meaningful error instead?


-- 
           Summary: [4.3 Regression] Confusing error message with missing
                    #include <algorithm>
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid, diagnostic
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org


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


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

* [Bug libstdc++/34105] [4.3 Regression] Confusing error message with missing #include <algorithm>
  2007-11-15  8:57 [Bug libstdc++/34105] New: [4.3 Regression] Confusing error message with missing #include <algorithm> rguenth at gcc dot gnu dot org
@ 2007-11-15 11:59 ` pcarlini at suse dot de
  2007-11-15 13:04 ` pcarlini at suse dot de
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pcarlini at suse dot de @ 2007-11-15 11:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pcarlini at suse dot de  2007-11-15 11:59 -------
Note that the issue is unrelated to the header optimization work: is caused by
algorithmfwd.h, added in the occasion of the parallel STL work. I'm going to
look a bit into it, anyway, if a simple solution I have in mind will not work,
will forward to Benjamin.


-- 

pcarlini at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-11-15 11:59:39
               date|                            |


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


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

* [Bug libstdc++/34105] [4.3 Regression] Confusing error message with missing #include <algorithm>
  2007-11-15  8:57 [Bug libstdc++/34105] New: [4.3 Regression] Confusing error message with missing #include <algorithm> rguenth at gcc dot gnu dot org
  2007-11-15 11:59 ` [Bug libstdc++/34105] " pcarlini at suse dot de
@ 2007-11-15 13:04 ` pcarlini at suse dot de
  2007-11-15 13:06 ` pcarlini at suse dot de
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pcarlini at suse dot de @ 2007-11-15 13:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pcarlini at suse dot de  2007-11-15 13:04 -------
Created an attachment (id=14555)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14555&action=view)
Draft patch for normal mode


-- 


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


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

* [Bug libstdc++/34105] [4.3 Regression] Confusing error message with missing #include <algorithm>
  2007-11-15  8:57 [Bug libstdc++/34105] New: [4.3 Regression] Confusing error message with missing #include <algorithm> rguenth at gcc dot gnu dot org
  2007-11-15 11:59 ` [Bug libstdc++/34105] " pcarlini at suse dot de
  2007-11-15 13:04 ` pcarlini at suse dot de
@ 2007-11-15 13:06 ` pcarlini at suse dot de
  2007-11-15 13:09 ` pcarlini at suse dot de
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pcarlini at suse dot de @ 2007-11-15 13:06 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 667 bytes --]



------- Comment #3 from pcarlini at suse dot de  2007-11-15 13:06 -------
Something like the attached (lightly tested) fixed the problem for normal mode,
the error becomes:

34105.cc: In function ‘int main()’:
34105.cc:8: error: ‘find’ is not a member of ‘std’

however, it doesn't for parallel mode. I think it's better if Benjamin looks
into those headers...


-- 

pcarlini at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bkoz at redhat dot com


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


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

* [Bug libstdc++/34105] [4.3 Regression] Confusing error message with missing #include <algorithm>
  2007-11-15  8:57 [Bug libstdc++/34105] New: [4.3 Regression] Confusing error message with missing #include <algorithm> rguenth at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-11-15 13:06 ` pcarlini at suse dot de
@ 2007-11-15 13:09 ` pcarlini at suse dot de
  2007-11-15 13:10 ` pcarlini at suse dot de
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pcarlini at suse dot de @ 2007-11-15 13:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pcarlini at suse dot de  2007-11-15 13:09 -------
By the way, while we are talking about those QoI issues, I think it's in any
case better not including something like algorithmfwd.h in algobase.h: it's
relatively big and we are doing our best to keep algobase.h, the core
algorithmic facilities optimized for internal use, as minimal as possible.


-- 


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


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

* [Bug libstdc++/34105] [4.3 Regression] Confusing error message with missing #include <algorithm>
  2007-11-15  8:57 [Bug libstdc++/34105] New: [4.3 Regression] Confusing error message with missing #include <algorithm> rguenth at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-11-15 13:09 ` pcarlini at suse dot de
@ 2007-11-15 13:10 ` pcarlini at suse dot de
  2007-11-15 18:15 ` pcarlini at suse dot de
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pcarlini at suse dot de @ 2007-11-15 13:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pcarlini at suse dot de  2007-11-15 13:10 -------
I meant bits/stl_algobase.h, of course.


-- 


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


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

* [Bug libstdc++/34105] [4.3 Regression] Confusing error message with missing #include <algorithm>
  2007-11-15  8:57 [Bug libstdc++/34105] New: [4.3 Regression] Confusing error message with missing #include <algorithm> rguenth at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2007-11-15 13:10 ` pcarlini at suse dot de
@ 2007-11-15 18:15 ` pcarlini at suse dot de
  2007-11-15 19:05 ` paolo at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pcarlini at suse dot de @ 2007-11-15 18:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pcarlini at suse dot de  2007-11-15 18:14 -------
I'm finishing testing a complete patch.


-- 

pcarlini at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pcarlini at suse dot de
                   |dot org                     |
             Status|NEW                         |ASSIGNED


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


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

* [Bug libstdc++/34105] [4.3 Regression] Confusing error message with missing #include <algorithm>
  2007-11-15  8:57 [Bug libstdc++/34105] New: [4.3 Regression] Confusing error message with missing #include <algorithm> rguenth at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2007-11-15 18:15 ` pcarlini at suse dot de
@ 2007-11-15 19:05 ` paolo at gcc dot gnu dot org
  2007-11-15 19:07 ` pcarlini at suse dot de
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: paolo at gcc dot gnu dot org @ 2007-11-15 19:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from paolo at gcc dot gnu dot org  2007-11-15 19:05 -------
Subject: Bug 34105

Author: paolo
Date: Thu Nov 15 19:05:17 2007
New Revision: 130207

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130207
Log:
2007-11-15  Paolo Carlini  <pcarlini@suse.de>

        PR libstdc++/34105
        * include/bits/stl_algobase.h: Do not include <bits/algorithmfwd.h>.
        (lexicographical_compare(const unsigned char*, const unsigned char*,
        const unsigned char*, const unsigned char*),
        lexicographical_compare(const char*, const char*, const char*,
        const char*)): Move to namespace (std, _GLIBCXX_STD_P).
        * include/parallel/algobase.h: Do not include <bits/algorithmfwd.h>.
        (equal): Move after mismatch.
        * include/bits/stl_heap.h (is_heap, is_heap_until): Reorder.
        * include/bits/char_traits.h: Include <bits/stl_algobase.h> instead
        of <bits/algorithmfwd.h>.
        * include/bits/stl_algo.h: Include first <bits/algorithmfwd.h>.
        * include/bits/algorithmfwd.h (lexicographical_compare): Do not
        declare overloads.
        * include/parallel/partition.h: Include <parallel/random_number.h>.
        * testsuite/util/testsuite_abi.cc: Include <algorithm>.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/bits/algorithmfwd.h
    trunk/libstdc++-v3/include/bits/char_traits.h
    trunk/libstdc++-v3/include/bits/stl_algo.h
    trunk/libstdc++-v3/include/bits/stl_algobase.h
    trunk/libstdc++-v3/include/bits/stl_heap.h
    trunk/libstdc++-v3/include/parallel/algobase.h
    trunk/libstdc++-v3/include/parallel/partition.h
    trunk/libstdc++-v3/testsuite/util/testsuite_abi.cc


-- 


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


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

* [Bug libstdc++/34105] [4.3 Regression] Confusing error message with missing #include <algorithm>
  2007-11-15  8:57 [Bug libstdc++/34105] New: [4.3 Regression] Confusing error message with missing #include <algorithm> rguenth at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2007-11-15 19:05 ` paolo at gcc dot gnu dot org
@ 2007-11-15 19:07 ` pcarlini at suse dot de
  2007-11-15 21:54 ` bkoz at gcc dot gnu dot org
  2007-11-16  9:45 ` rguenther at suse dot de
  9 siblings, 0 replies; 11+ messages in thread
From: pcarlini at suse dot de @ 2007-11-15 19:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pcarlini at suse dot de  2007-11-15 19:07 -------
Fixed.


-- 

pcarlini at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.3.0


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


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

* [Bug libstdc++/34105] [4.3 Regression] Confusing error message with missing #include <algorithm>
  2007-11-15  8:57 [Bug libstdc++/34105] New: [4.3 Regression] Confusing error message with missing #include <algorithm> rguenth at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2007-11-15 19:07 ` pcarlini at suse dot de
@ 2007-11-15 21:54 ` bkoz at gcc dot gnu dot org
  2007-11-16  9:45 ` rguenther at suse dot de
  9 siblings, 0 replies; 11+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2007-11-15 21:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from bkoz at gcc dot gnu dot org  2007-11-15 21:54 -------

Awesome. Looks good. 


-- 


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


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

* [Bug libstdc++/34105] [4.3 Regression] Confusing error message with missing #include <algorithm>
  2007-11-15  8:57 [Bug libstdc++/34105] New: [4.3 Regression] Confusing error message with missing #include <algorithm> rguenth at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2007-11-15 21:54 ` bkoz at gcc dot gnu dot org
@ 2007-11-16  9:45 ` rguenther at suse dot de
  9 siblings, 0 replies; 11+ messages in thread
From: rguenther at suse dot de @ 2007-11-16  9:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from rguenther at suse dot de  2007-11-16 09:45 -------
Subject: Re:  [4.3 Regression] Confusing error message
 with missing #include <algorithm>

On Thu, 15 Nov 2007, pcarlini at suse dot de wrote:

> ------- Comment #8 from pcarlini at suse dot de  2007-11-15 19:07 -------
> Fixed.

Thanks Paolo!

Richard.


-- 


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


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

end of thread, other threads:[~2007-11-16  9:45 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-15  8:57 [Bug libstdc++/34105] New: [4.3 Regression] Confusing error message with missing #include <algorithm> rguenth at gcc dot gnu dot org
2007-11-15 11:59 ` [Bug libstdc++/34105] " pcarlini at suse dot de
2007-11-15 13:04 ` pcarlini at suse dot de
2007-11-15 13:06 ` pcarlini at suse dot de
2007-11-15 13:09 ` pcarlini at suse dot de
2007-11-15 13:10 ` pcarlini at suse dot de
2007-11-15 18:15 ` pcarlini at suse dot de
2007-11-15 19:05 ` paolo at gcc dot gnu dot org
2007-11-15 19:07 ` pcarlini at suse dot de
2007-11-15 21:54 ` bkoz at gcc dot gnu dot org
2007-11-16  9:45 ` rguenther at suse dot de

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