public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/39802] New: std::num_get fails to pase negative zero input correctly
@ 2009-04-17 22:26 ritter at roguewave dot com
2009-04-18 1:17 ` [Bug libstdc++/39802] std::num_get fails to parse " paolo dot carlini at oracle dot com
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: ritter at roguewave dot com @ 2009-04-17 22:26 UTC (permalink / raw)
To: gcc-bugs
A call to std::num_get fails to parse negative values (specifically -0 in my
example).
/** Begin Test **/
#include <cassert>
#include <locale>
#include <sstream>
int main ()
{
unsigned long val = 1;
std::stringbuf sb ("-0");
std::istream is (&sb);
std::ios_base::iostate err (std::ios_base::goodbit);
typedef std::istreambuf_iterator<char> iter_t;
const std::num_get<char, iter_t>& fac =
std::use_facet<std::num_get <char> >(is.getloc ());
fac.get (is, iter_t (), is, err, val);
assert (is.eofbit == err && 0 == val);
return 0;
}
/** End Test **/
Even thought this test case only exercises -0 I think the method should be able
to handle any negative value. I have noted that other implementations do not
appear to exhibit this behavior.
--
Summary: std::num_get fails to pase negative zero input correctly
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ritter at roguewave dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39802
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libstdc++/39802] std::num_get fails to parse negative zero input correctly
2009-04-17 22:26 [Bug libstdc++/39802] New: std::num_get fails to pase negative zero input correctly ritter at roguewave dot com
@ 2009-04-18 1:17 ` paolo dot carlini at oracle dot com
2009-04-18 19:29 ` paolo at gcc dot gnu dot org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-04-18 1:17 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from paolo dot carlini at oracle dot com 2009-04-18 01:17 -------
Oops, apparently we never parsed correctly negative values for unsigned. The
fix is simple.
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |paolo dot carlini at oracle
|dot org |dot com
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2009-04-18 01:17:12
date| |
Summary|std::num_get fails to pase |std::num_get fails to parse
|negative zero input |negative zero input
|correctly |correctly
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39802
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libstdc++/39802] std::num_get fails to parse negative zero input correctly
2009-04-17 22:26 [Bug libstdc++/39802] New: std::num_get fails to pase negative zero input correctly ritter at roguewave dot com
2009-04-18 1:17 ` [Bug libstdc++/39802] std::num_get fails to parse " paolo dot carlini at oracle dot com
@ 2009-04-18 19:29 ` paolo at gcc dot gnu dot org
2009-04-18 19:31 ` paolo dot carlini at oracle dot com
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: paolo at gcc dot gnu dot org @ 2009-04-18 19:29 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from paolo at gcc dot gnu dot org 2009-04-18 19:28 -------
Subject: Bug 39802
Author: paolo
Date: Sat Apr 18 19:28:40 2009
New Revision: 146323
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=146323
Log:
2009-04-18 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/39802
* include/bits/locale_facets.tcc (num_get<>::_M_extract_int
(_InIter, _InIter, ios_base&, ios_base::iostate&, _ValueT&)):
Always accept negative values, for unsigned types too.
* testsuite/22_locale/num_get/get/char/39802.cc: New.
* testsuite/22_locale/num_get/get/wchar_t/39802.cc: Likewise.
Added:
trunk/libstdc++-v3/testsuite/22_locale/num_get/get/char/39802.cc
trunk/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/39802.cc
Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/include/bits/locale_facets.tcc
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39802
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libstdc++/39802] std::num_get fails to parse negative zero input correctly
2009-04-17 22:26 [Bug libstdc++/39802] New: std::num_get fails to pase negative zero input correctly ritter at roguewave dot com
2009-04-18 1:17 ` [Bug libstdc++/39802] std::num_get fails to parse " paolo dot carlini at oracle dot com
2009-04-18 19:29 ` paolo at gcc dot gnu dot org
@ 2009-04-18 19:31 ` paolo dot carlini at oracle dot com
2009-04-21 20:27 ` paolo at gcc dot gnu dot org
2009-04-21 20:27 ` paolo dot carlini at oracle dot com
4 siblings, 0 replies; 6+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-04-18 19:31 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from paolo dot carlini at oracle dot com 2009-04-18 19:31 -------
Fixed in mainline, will be fixed in 4.4.1 too.
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.4.1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39802
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libstdc++/39802] std::num_get fails to parse negative zero input correctly
2009-04-17 22:26 [Bug libstdc++/39802] New: std::num_get fails to pase negative zero input correctly ritter at roguewave dot com
` (2 preceding siblings ...)
2009-04-18 19:31 ` paolo dot carlini at oracle dot com
@ 2009-04-21 20:27 ` paolo at gcc dot gnu dot org
2009-04-21 20:27 ` paolo dot carlini at oracle dot com
4 siblings, 0 replies; 6+ messages in thread
From: paolo at gcc dot gnu dot org @ 2009-04-21 20:27 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from paolo at gcc dot gnu dot org 2009-04-21 20:27 -------
Subject: Bug 39802
Author: paolo
Date: Tue Apr 21 20:26:46 2009
New Revision: 146538
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=146538
Log:
2009-04-21 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/39802
* include/bits/locale_facets.tcc (num_get<>::_M_extract_int
(_InIter, _InIter, ios_base&, ios_base::iostate&, _ValueT&)):
Always accept negative values, for unsigned types too.
* testsuite/22_locale/num_get/get/char/39802.cc: New.
* testsuite/22_locale/num_get/get/wchar_t/39802.cc: Likewise.
Added:
branches/gcc-4_4-branch/libstdc++-v3/testsuite/22_locale/num_get/get/char/39802.cc
branches/gcc-4_4-branch/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/39802.cc
Modified:
branches/gcc-4_4-branch/libstdc++-v3/ChangeLog
branches/gcc-4_4-branch/libstdc++-v3/include/bits/locale_facets.tcc
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39802
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libstdc++/39802] std::num_get fails to parse negative zero input correctly
2009-04-17 22:26 [Bug libstdc++/39802] New: std::num_get fails to pase negative zero input correctly ritter at roguewave dot com
` (3 preceding siblings ...)
2009-04-21 20:27 ` paolo at gcc dot gnu dot org
@ 2009-04-21 20:27 ` paolo dot carlini at oracle dot com
4 siblings, 0 replies; 6+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-04-21 20:27 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from paolo dot carlini at oracle dot com 2009-04-21 20:27 -------
Fixed.
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39802
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-04-21 20:27 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-17 22:26 [Bug libstdc++/39802] New: std::num_get fails to pase negative zero input correctly ritter at roguewave dot com
2009-04-18 1:17 ` [Bug libstdc++/39802] std::num_get fails to parse " paolo dot carlini at oracle dot com
2009-04-18 19:29 ` paolo at gcc dot gnu dot org
2009-04-18 19:31 ` paolo dot carlini at oracle dot com
2009-04-21 20:27 ` paolo at gcc dot gnu dot org
2009-04-21 20:27 ` 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).