public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* other/9274: [pch] Big troubles with v3
@ 2003-01-11 15:26 pcarlini
  0 siblings, 0 replies; 5+ messages in thread
From: pcarlini @ 2003-01-11 15:26 UTC (permalink / raw)
  To: gcc-gnats


>Number:         9274
>Category:       other
>Synopsis:       [pch] Big troubles with v3
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jan 11 07:26:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Paolo Carlini
>Release:        g++ (GCC) 3.4 20030111 (experimental)
>Organization:
>Environment:
i686-pc-linux-gnu, glibc2.3.1, binutils2.13.2.1
>Description:
Consider:
<header.h>
#include <iostream>
#include <string>

<test1.cc>
#include "header.h"

int main()
{
  std::cout << "Hello World!" << std::endl;
}

<test2.cc>
#include "header.h"

int main()
{
  std::string str = "Hello World!";
  std::cout << str << '\n';
}

After a 'g++ -x c++-header header.h', I get:

-test1.cc
/tmp/ccM9ZCnR.o: In function `main':
/tmp/ccM9ZCnR.o(.text+0x30): undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))'
collect2: ld returned 1 exit status

-test2.cc
/usr/local/gcc-exp/include/c++/3.4/bits/stl_algobase.h:149: warning: inline
   function `const _Tp& std::min(const _Tp&, const _Tp&) [with _Tp = size_t]'
   used but never defined
/usr/local/gcc-exp/include/c++/3.4/cmath:391: warning: inline function `_Tp
   std::__pow_helper(_Tp, int) [with _Tp = double]' used but never defined
/usr/local/gcc-exp/include/c++/3.4/cmath:391: warning: inline function `_Tp
   std::__pow_helper(_Tp, int) [with _Tp = float]' used but never defined
/usr/local/gcc-exp/include/c++/3.4/cmath:391: warning: inline function `_Tp
   std::__pow_helper(_Tp, int) [with _Tp = long double]' used but never defined
/tmp/cc2tQmQg.o: In function `main':
/tmp/cc2tQmQg.o(.text+0x18): undefined reference to `std::allocator<char>::allocator[in-charge]()'
/tmp/cc2tQmQg.o(.text+0x32): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string[in-charge](char const*, std::allocator<char> const&)'
/tmp/cc2tQmQg.o(.text+0x45): undefined reference to `std::allocator<char>::~allocator [in-charge]()'
/tmp/cc2tQmQg.o(.text+0x5e): undefined reference to `std::allocator<char>::~allocator [in-charge]()'
/tmp/cc2tQmQg.o(.text+0x71): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <char, std::char_traits<char>, std::allocator<char> >(std::basic_ostream<char, std::char_traits<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/tmp/cc2tQmQg.o(.text+0x94): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string [in-charge]()'
/tmp/cc2tQmQg.o(.text+0xad): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string [in-charge]()'
collect2: ld returned 1 exit status
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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

* Re: other/9274: [pch] Big troubles with v3
@ 2003-01-29 18:16 Benjamin Kosnik
  0 siblings, 0 replies; 5+ messages in thread
From: Benjamin Kosnik @ 2003-01-29 18:16 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR other/9274; it has been noted by GNATS.

From: Benjamin Kosnik <bkoz@redhat.com>
To: Geoff Keating <geoffk@geoffk.org>
Cc: bkoz@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
	geoffk@geoffk.org, nobody@gcc.gnu.org, pcarlini@unitus.it,
	gcc-gnats@gcc.gnu.org, fjahanian@apple.com
Subject: Re: other/9274: [pch] Big troubles with v3
Date: Wed, 29 Jan 2003 12:10:05 -0600

 On Tue, 28 Jan 2003 12:47:08 -0800
 Geoff Keating <geoffk@geoffk.org> wrote:
 
 >This is a known bug, a workaround is to use -O2 (when it'll get
 >inlined).  Fariborz is working on the fix, he's testing one now.
 
 Great! I saw this patch fly by yesterday. I'll be back on this next week.
 
 -benjamin


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

* Re: other/9274: [pch] Big troubles with v3
@ 2003-01-29 12:56 Paolo Carlini
  0 siblings, 0 replies; 5+ messages in thread
From: Paolo Carlini @ 2003-01-29 12:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR other/9274; it has been noted by GNATS.

From: Paolo Carlini <pcarlini@unitus.it>
To: Geoff Keating <geoffk@geoffk.org>
Cc: bkoz@gcc.gnu.org,  gcc-bugs@gcc.gnu.org,  gcc-prs@gcc.gnu.org, 
 nobody@gcc.gnu.org,  gcc-gnats@gcc.gnu.org, 
 Fariborz Jahanian <fjahanian@apple.com>
Subject: Re: other/9274: [pch] Big troubles with v3
Date: Wed, 29 Jan 2003 13:48:20 +0100

 Geoff Keating wrote:
 
 >>  /mnt/hd/ahimsa/bld-x86-gcc/i686-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:149: warning: inline
 >>       function `const _Tp& std::min(const _Tp&, const _Tp&) [with _Tp = size_t]' 
 >>       used but never defined
 >>    
 >>
 >This is a known bug, a workaround is to use -O2 (when it'll get
 >inlined).  Fariborz is working on the fix, he's testing one now.
 >
 Great! Indeed, this specific problem doesn't show up anymore for me.
 
 However, it seems that both the testcases in other/9274 still trigger 
 all the other errors...
 
 Thanks,
 Paolo.
 
 
 


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

* Re: other/9274: [pch] Big troubles with v3
@ 2003-01-28 20:56 Geoff Keating
  0 siblings, 0 replies; 5+ messages in thread
From: Geoff Keating @ 2003-01-28 20:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR other/9274; it has been noted by GNATS.

From: Geoff Keating <geoffk@geoffk.org>
To: bkoz@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
   geoffk@geoffk.org, nobody@gcc.gnu.org, pcarlini@unitus.it,
   gcc-gnats@gcc.gnu.org
Cc: gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org,
   pcarlini@unitus.it, Fariborz Jahanian <fjahanian@apple.com>
Subject: Re: other/9274: [pch] Big troubles with v3
Date: Tue, 28 Jan 2003 12:47:08 -0800

 >     /mnt/hd/ahimsa/bld-x86-gcc/i686-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:149: warning: inline
 >        function `const _Tp& std::min(const _Tp&, const _Tp&) [with _Tp = size_t]' 
 >        used but never defined
 
 This is a known bug, a workaround is to use -O2 (when it'll get
 inlined).  Fariborz is working on the fix, he's testing one now.
 
 -- 
 - Geoffrey Keating <geoffk@geoffk.org>


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

* Re: other/9274: [pch] Big troubles with v3
@ 2003-01-28  3:46 bkoz
  0 siblings, 0 replies; 5+ messages in thread
From: bkoz @ 2003-01-28  3:46 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, geoffk, nobody, pcarlini

Synopsis: [pch] Big troubles with v3

State-Changed-From-To: open->analyzed
State-Changed-By: bkoz
State-Changed-When: Tue Jan 28 03:45:59 2003
State-Changed-Why:
    I ran into this too. This problem makes pch unusable for g++/libstdc++.
    
    Take the following:
    %COMP.sh "-x c++-header -Winvalid-pch" ostream
    /mnt/hd/ahimsa/bld-x86-gcc/i686-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:149: warning: inline
       function `const _Tp& std::min(const _Tp&, const _Tp&) [with _Tp = size_t]' 
       used but never defined
    /mnt/hd/ahimsa/bld-x86-gcc/i686-pc-linux-gnu/libstdc++-v3/include/cmath:391: warning: inline
       function `_Tp std::__pow_helper(_Tp, int) [with _Tp = float]' used but never    defined
    /mnt/hd/ahimsa/bld-x86-gcc/i686-pc-linux-gnu/libstdc++-v3/include/cmath:391: warning: inline
       function `_Tp std::__pow_helper(_Tp, int) [with _Tp = long double]' used but    never defined
    
    
    So I think, hmm, this is odd, never had this problem before. 
    
    I take a look at the pre-processed output, and make sure that the template definition of max is declared, and defined, before first use.
    
    Check. In stl_algobase.h, 148:
    
      #undef min
      #undef max
    
      /**
       *  @brief This does what you think it does.
       *  @param  a  A thing of arbitrary type.
       *  @param  b  Another thing of arbitrary type.
       *  @return   The lesser of the parameters.
       *
       *  This is the simple classic generic implementation.  It will work on
       *  temporary expressions, since they are only evaluated once, unlike a
       *  preprocessor macro.
      */
      template<typename _Tp>
        inline const _Tp&
        min(const _Tp& __a, const _Tp& __b)
        {
          // concept requirements
          __glibcpp_function_requires(_LessThanComparableConcept<_Tp>)
          //return __b < __a ? __b : __a;
          if (__b < __a) return __b; return __a;
        }
    
    Removing the "inline" keyword from the declaration gets past this, but kind of kills the point of this function, and the value of pch in general.
    
    -benjamin

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9274


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

end of thread, other threads:[~2003-01-29 18:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-11 15:26 other/9274: [pch] Big troubles with v3 pcarlini
2003-01-28  3:46 bkoz
2003-01-28 20:56 Geoff Keating
2003-01-29 12:56 Paolo Carlini
2003-01-29 18:16 Benjamin Kosnik

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