public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libstdc++/9659: 3.3/3.4 seekoff overload problem with optimization
@ 2003-02-11 19:57 paolo
0 siblings, 0 replies; 3+ messages in thread
From: paolo @ 2003-02-11 19:57 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, paolo, snyder
Synopsis: 3.3/3.4 seekoff overload problem with optimization
State-Changed-From-To: analyzed->closed
State-Changed-By: paolo
State-Changed-When: Tue Feb 11 19:57:46 2003
State-Changed-Why:
Fixed. Thanks Scott for spotting this!
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9659
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: libstdc++/9659: 3.3/3.4 seekoff overload problem with optimization
@ 2003-02-11 10:48 paolo
0 siblings, 0 replies; 3+ messages in thread
From: paolo @ 2003-02-11 10:48 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, nobody, paolo, snyder
Synopsis: 3.3/3.4 seekoff overload problem with optimization
Responsible-Changed-From-To: unassigned->paolo
Responsible-Changed-By: paolo
Responsible-Changed-When: Tue Feb 11 10:48:23 2003
Responsible-Changed-Why:
Patching.
State-Changed-From-To: open->analyzed
State-Changed-By: paolo
State-Changed-When: Tue Feb 11 10:48:23 2003
State-Changed-Why:
Confirmed. Will apply your patch shortly.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9659
^ permalink raw reply [flat|nested] 3+ messages in thread
* libstdc++/9659: 3.3/3.4 seekoff overload problem with optimization
@ 2003-02-11 10:26 snyder
0 siblings, 0 replies; 3+ messages in thread
From: snyder @ 2003-02-11 10:26 UTC (permalink / raw)
To: gcc-gnats
>Number: 9659
>Category: libstdc++
>Synopsis: 3.3/3.4 seekoff overload problem with optimization
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Tue Feb 11 10:26:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: scott snyder
>Release: 3.4 20030210 (experimental)
>Organization:
<organization of PR author (multiple lines)>
>Environment:
System: Linux karma 2.4.19-emp_2419p5a829i #1 Tue Sep 3 17:42:17 EST 2002 i686 unknown
Architecture: i686
<machine, os, target, libraries (multiple lines)>
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc/configure --prefix=/usr/local/gcc --enable-threads=posix --enable-long-long
>Description:
When the source below is compiled with -O3, i get the following errors:
$ g++ -c -O3 x.cc
/usr/local/gcc/include/c++/3.4/bits/fstream.tcc: In member function `typename
std::basic_filebuf<_CharT, _Traits>::pos_type std::basic_filebuf<_CharT,
_Traits>::seekoff(typename _Traits::off_type, std::_Ios_Seekdir,
std::_Ios_Openmode) [with _CharT = char, _Traits = std::char_traits<char>]':
/usr/local/gcc/include/c++/3.4/bits/fstream.tcc:104: instantiated from `typename std::basic_filebuf<_CharT, _Traits>::__filebuf_type* std::basic_filebuf<_CharT, _Traits>::open(const char*, std::_Ios_Openmode) [with _CharT = char, _Traits = std::char_traits<char>]'
/usr/local/gcc/include/c++/3.4/fstream:564: instantiated from `void std::basic_ifstream<_CharT, _Traits>::open(const char*, std::_Ios_Openmode) [with _CharT = char, _Traits = std::char_traits<char>]'
/usr/local/gcc/include/c++/3.4/fstream:520: instantiated from `std::basic_ifstream<_CharT, _Traits>::basic_ifstream(const char*, std::_Ios_Openmode) [with _CharT = char, _Traits = std::char_traits<char>]'
x.cc:9: instantiated from here
/usr/local/gcc/include/c++/3.4/bits/fstream.tcc:460: error: ambiguous overload
for `std::streampos& + char* const&' operator
/usr/local/gcc/include/c++/3.4/bits/fstream.tcc:460: error: candidates are:
operator+(int, char*) <built-in>
/usr/local/gcc/include/c++/3.4/bits/fpos.h:90: error:
std::fpos<_StateT> std::fpos<_StateT>::operator+(long int) [with _StateT =
mbstate_t] <near match>
x.cc:6: error: TString operator+(long int, const TString&)
$
It's a bit strange, because if -O2 or below is used, the error goes away.
Is the built-in operator mentioned in the error message visible only
if -O3 is used?
I see this problem both with 3.3 and 3.4.
It seems to be related to the patch for libstdc++/9439 and
libstdc++/9425 that was introduced recently. In fact,
if i rewrite the part of that patch where this error
is occuring to use += rather than +:
Index: fstream.tcc
===================================================================
RCS file: /cvsroot/gcc/gcc/libstdc++-v3/include/bits/fstream.tcc,v
retrieving revision 1.47
diff -u -p -c -r1.47 fstream.tcc
*** fstream.tcc 4 Feb 2003 22:42:32 -0000 1.47
--- fstream.tcc 11 Feb 2003 09:54:38 -0000
*************** namespace std
*** 455,464 ****
{
pos_type __tmp =
_M_file.seekoff(__off, ios_base::cur, __mode);
! if (__tmp >= 0)
// Seek successful.
! __ret = __tmp +
! std::max(this->_M_out_cur, this->_M_in_cur) - _M_filepos;
}
}
_M_last_overflowed = false;
--- 455,465 ----
{
pos_type __tmp =
_M_file.seekoff(__off, ios_base::cur, __mode);
! if (__tmp >= 0) {
// Seek successful.
! __ret = __tmp;
! __ret += std::max(this->_M_out_cur, this->_M_in_cur) - _M_filepos;
! }
}
}
_M_last_overflowed = false;
then the error goes away.
>How-To-Repeat:
Compile with -O3:
----------------------
#include <fstream>
struct TString {
TString(const char *s);
};
TString operator+(long i, const TString& s);
void is_new(const char* f) {
std::ifstream test(f,std::ios::in);
}
----------------------
>Fix:
See above.
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-02-11 19:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-11 19:57 libstdc++/9659: 3.3/3.4 seekoff overload problem with optimization paolo
-- strict thread matches above, loose matches on Subject: below --
2003-02-11 10:48 paolo
2003-02-11 10:26 snyder
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).