public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11838] New: boost::lexical_cast segfault
@ 2003-08-06 19:50 stl at caltech dot edu
2003-08-06 20:44 ` [Bug c++/11838] " pinskia at physics dot uc dot edu
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: stl at caltech dot edu @ 2003-08-06 19:50 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11838
Summary: boost::lexical_cast segfault
Product: gcc
Version: 3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: stl at caltech dot edu
CC: gcc-bugs at gcc dot gnu dot org
crash.cc:
----
#include <boost/lexical_cast.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
int main() {
boost::lexical_cast<int>(
boost::gregorian::date(1969, boost::gregorian::Jul, 21).month()
);
}
----
[08/06/2003 Wed 12:39.25 PM stl@nuwen ~/temp]
> g++ --version
g++ (GCC) 3.3
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[08/06/2003 Wed 12:39.27 PM stl@nuwen ~/temp]
> g++ -Wall -W crash.cc -o crash
[08/06/2003 Wed 12:39.42 PM stl@nuwen ~/temp]
> crash
Segmentation fault
[08/06/2003 Wed 12:39.54 PM stl@nuwen ~/temp]
>
3.3 and 3.4-20030806 behave identically. I haven't tried any other versions.
MinGW gcc 3.3 on WinXP also produces a segfaulting executable.
The problem does not appear to be on Boost's end; I have been told that
MSVC.NET 2003 compiles this correctly.
I would submit preprocessed source, but it's about a megabyte. I've tried to
reduce the test case as much as possible, but it seems that anything more
eliminates the segfault.
The workaround is to lexical_cast<whatever, int> instead of
lexical_cast<whatever>. I originally encountered this problem when using
lexical_cast<string> but I have changed it to lexical_cast<int> as above to
demonstrate that this is not related to some quirk of string.
Stepping through the program's execution with gdb:
----
(gdb)
0x080497ef in
boost::date_time::gregorian_calendar_base<boost::date_time::year_month_day_base
<boost::gregorian::greg_year, boost::gregorian::greg_month,
boost::gregorian::greg_day>, unsigned long>::from_day_number(unsigned long)
(dayNumber=2440424) at gregorian_calendar.ipp:125
125 return ymd_type(year,month,day);
(gdb)
boost::date_time::date<boost::gregorian::date,
boost::gregorian::gregorian_calendar, boost::date_time::date_duration<long>
>::month() const (this=0xbfffdbbc) at date.hpp:81
81 return ymd.month;
(gdb)
Program received signal SIGSEGV, Segmentation fault.
0x08049d56 in std::ios_base::getloc() const (this=0xbfffdb04) at ios_base.h:614
614 getloc() const { return _M_ios_locale; }
(gdb)
----
Sometimes the segfault occurs elsewhere:
----
Program received signal SIGSEGV, Segmentation fault.
0x080498fa in operator<< <char, std::char_traits<char> > (os=@0xbfffe928,
m=@0xbfffea20) at greg_facet.hpp:58
58 std::locale locale = os.getloc();
----
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/11838] boost::lexical_cast segfault
2003-08-06 19:50 [Bug c++/11838] New: boost::lexical_cast segfault stl at caltech dot edu
@ 2003-08-06 20:44 ` pinskia at physics dot uc dot edu
2003-08-07 0:34 ` [Bug libstdc++/11838] " pinskia at physics dot uc dot edu
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-08-06 20:44 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11838
pinskia at physics dot uc dot edu changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
------- Additional Comments From pinskia at physics dot uc dot edu 2003-08-06 20:44 -------
Wee need the preprocessed file as not every one has boost install?
Can you provide both the 3.3 one and the 3.4 one. Use gzip or bzip2 if you want the size
to go down.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug libstdc++/11838] boost::lexical_cast segfault
2003-08-06 19:50 [Bug c++/11838] New: boost::lexical_cast segfault stl at caltech dot edu
2003-08-06 20:44 ` [Bug c++/11838] " pinskia at physics dot uc dot edu
@ 2003-08-07 0:34 ` pinskia at physics dot uc dot edu
2003-08-07 1:59 ` pinskia at physics dot uc dot edu
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-08-07 0:34 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11838
pinskia at physics dot uc dot edu changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|c++ |libstdc++
------- Additional Comments From pinskia at physics dot uc dot edu 2003-08-07 00:34 -------
>From looking at the code:
template <class charT, class traits>
inline
std::basic_ostream<charT, traits>&
operator<<(std::basic_ostream<charT, traits>& os, const greg_month& m)
{
typedef boost::date_time::ostream_month_formatter<greg_base_facet, charT>
greg_month_formatter;
std::locale locale = os.getloc();
if (std::has_facet<greg_base_facet>(locale)) {
const greg_base_facet& f = std::use_facet<greg_base_facet>(locale);
greg_month_formatter::format_month(m, os, f);
}
else {
os << std::setw(2) << std::setfill('0') << m; //this line
}
return os;
}
The problem there is stack overflow that is causing the seg fault but that is because the
line marked this line is calling the same function over and over. I do not know if this is a
boost problem or libstdc++ problem (becuase I do not like locals at all and I do not know
them).
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug libstdc++/11838] boost::lexical_cast segfault
2003-08-06 19:50 [Bug c++/11838] New: boost::lexical_cast segfault stl at caltech dot edu
2003-08-06 20:44 ` [Bug c++/11838] " pinskia at physics dot uc dot edu
2003-08-07 0:34 ` [Bug libstdc++/11838] " pinskia at physics dot uc dot edu
@ 2003-08-07 1:59 ` pinskia at physics dot uc dot edu
2003-08-07 1:59 ` pinskia at physics dot uc dot edu
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-08-07 1:59 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11838
pinskia at physics dot uc dot edu changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |RESOLVED
Resolution| |INVALID
------- Additional Comments From pinskia at physics dot uc dot edu 2003-08-07 01:59 -------
Marking this as invalid to mark it as ...
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug libstdc++/11838] boost::lexical_cast segfault
2003-08-06 19:50 [Bug c++/11838] New: boost::lexical_cast segfault stl at caltech dot edu
` (2 preceding siblings ...)
2003-08-07 1:59 ` pinskia at physics dot uc dot edu
@ 2003-08-07 1:59 ` pinskia at physics dot uc dot edu
2003-08-28 16:03 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-08-07 1:59 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11838
pinskia at physics dot uc dot edu changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
------- Additional Comments From pinskia at physics dot uc dot edu 2003-08-07 01:59 -------
Unconfirmed.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug libstdc++/11838] boost::lexical_cast segfault
2003-08-06 19:50 [Bug c++/11838] New: boost::lexical_cast segfault stl at caltech dot edu
` (3 preceding siblings ...)
2003-08-07 1:59 ` pinskia at physics dot uc dot edu
@ 2003-08-28 16:03 ` pinskia at gcc dot gnu dot org
2003-08-28 20:16 ` stl at caltech dot edu
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-08-28 16:03 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11838
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-08-28 16:03 -------
Can a libstdc++ export look at this one because I think boost's code is not doing what they think
it should do?
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug libstdc++/11838] boost::lexical_cast segfault
2003-08-06 19:50 [Bug c++/11838] New: boost::lexical_cast segfault stl at caltech dot edu
` (4 preceding siblings ...)
2003-08-28 16:03 ` pinskia at gcc dot gnu dot org
@ 2003-08-28 20:16 ` stl at caltech dot edu
2003-08-28 20:23 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: stl at caltech dot edu @ 2003-08-28 20:16 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11838
------- Additional Comments From stl at caltech dot edu 2003-08-28 20:16 -------
Is this related?
http://lists.boost.org/MailArchives/boost/msg51572.php
It looks like this may be Boost's fault, not gcc's. But I don't know enough
about Boost internals or locales to really know.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug libstdc++/11838] boost::lexical_cast segfault
2003-08-06 19:50 [Bug c++/11838] New: boost::lexical_cast segfault stl at caltech dot edu
` (5 preceding siblings ...)
2003-08-28 20:16 ` stl at caltech dot edu
@ 2003-08-28 20:23 ` pinskia at gcc dot gnu dot org
2003-09-13 23:45 ` stl at caltech dot edu
2003-09-14 2:08 ` pinskia at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-08-28 20:23 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11838
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Alias| |boost796799
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-08-28 20:23 -------
It is the same bug, as I looked at why the seg fault happening before but I still do not know if it is
boost's bug or ours, GCC.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug libstdc++/11838] boost::lexical_cast segfault
2003-08-06 19:50 [Bug c++/11838] New: boost::lexical_cast segfault stl at caltech dot edu
` (6 preceding siblings ...)
2003-08-28 20:23 ` pinskia at gcc dot gnu dot org
@ 2003-09-13 23:45 ` stl at caltech dot edu
2003-09-14 2:08 ` pinskia at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: stl at caltech dot edu @ 2003-09-13 23:45 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11838
------- Additional Comments From stl at caltech dot edu 2003-09-13 21:39 -------
It turns out that this is boost's bug. See:
http://lists.boost.org/MailArchives/boost/msg52323.php
This bug can be closed (as INVALID?). Thanks.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug libstdc++/11838] boost::lexical_cast segfault
2003-08-06 19:50 [Bug c++/11838] New: boost::lexical_cast segfault stl at caltech dot edu
` (7 preceding siblings ...)
2003-09-13 23:45 ` stl at caltech dot edu
@ 2003-09-14 2:08 ` pinskia at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-09-14 2:08 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11838
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-09-14 00:38 -------
Not GCC bug but rather a boost bug.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2003-09-14 0:38 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-06 19:50 [Bug c++/11838] New: boost::lexical_cast segfault stl at caltech dot edu
2003-08-06 20:44 ` [Bug c++/11838] " pinskia at physics dot uc dot edu
2003-08-07 0:34 ` [Bug libstdc++/11838] " pinskia at physics dot uc dot edu
2003-08-07 1:59 ` pinskia at physics dot uc dot edu
2003-08-07 1:59 ` pinskia at physics dot uc dot edu
2003-08-28 16:03 ` pinskia at gcc dot gnu dot org
2003-08-28 20:16 ` stl at caltech dot edu
2003-08-28 20:23 ` pinskia at gcc dot gnu dot org
2003-09-13 23:45 ` stl at caltech dot edu
2003-09-14 2:08 ` pinskia at gcc dot gnu dot org
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).