Bug 13369 - __verify_grouping (and __add_grouping?) not correct
Summary: __verify_grouping (and __add_grouping?) not correct
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: 3.3.3
Assignee: Paolo Carlini
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-12-09 14:15 UTC by Paolo Carlini
Modified: 2004-01-29 02:52 UTC (History)
1 user (show)

See Also:
Host: Any
Target: Any
Build:
Known to work:
Known to fail:
Last reconfirmed: 2003-12-09 14:30:09


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paolo Carlini 2003-12-09 14:15:17 UTC
This is one those internal memos...

I'm comparing 22.2.3.1.2, p3 to our current implementation, some things seem
wrong. For instance, in __verify_grouping, when __j == __len, we exit the for
loop, then enter it again with __j reset to zero and do the for loop again.
This is not ok: instead, we should from now on keep __j fixed at __len - 1.
Example: "\04\03\02", means that 12,34,56,789,0123 is ok, that is, the final
\02 matches any number of initial two digits groups. 

Also, if a group has value <= 0 it means an unlimited size for the group (of
course it's meaningful only as the last group) and should match *any* possible
length for the first parsed group.
Comment 1 Paolo Carlini 2003-12-09 14:30:08 UTC
A value of CHAR_MAX for a group also means an unlimited group, and it's more 
interesting than zero, since the latter *cannot* actually occur in the stored
grouping: \0 delimits the string returned by __nl_langinfo_l(GROUPING, __cloc);

Comment 2 GCC Commits 2003-12-30 10:44:06 UTC
Subject: Bug 13369

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	paolo@gcc.gnu.org	2003-12-30 10:43:54

Modified files:
	libstdc++-v3   : ChangeLog 
	libstdc++-v3/include/bits: locale_facets.tcc 
Added files:
	libstdc++-v3/testsuite/22_locale/num_get/get/char: 13.cc 
	libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t: 13.cc 

Log message:
	2003-12-30  Paolo Carlini  <pcarlini@suse.de>
	
	PR libstdc++/13369
	* include/bits/locale_facets.tcc (__verify_grouping):
	Fix to deal properly with __grouping_tmp.size() >
	__grouping.size().
	* testsuite/22_locale/num_get/get/char/13.cc: New.
	* testsuite/22_locale/num_get/get/wchar_t/13.cc: Ditto.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&r1=1.2190&r2=1.2191
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/bits/locale_facets.tcc.diff?cvsroot=gcc&r1=1.160&r2=1.161
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/22_locale/num_get/get/char/13.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/13.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 3 Paolo Carlini 2003-12-30 10:45:01 UTC
Fixed for 3.4.0.
Comment 4 GCC Commits 2004-01-29 02:52:28 UTC
Subject: Bug 13369

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	paolo@gcc.gnu.org	2004-01-29 02:52:25

Modified files:
	libstdc++-v3   : ChangeLog 
	libstdc++-v3/include/bits: locale_facets.tcc 

Log message:
	2004-01-28  Paolo Carlini  <pcarlini@suse.de>
	
	PR libstdc++/13369
	* include/bits/locale_facets.tcc (__verify_grouping):
	Fix to deal properly with __grouping_tmp.size() >
	__grouping.size().

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.1464.2.177&r2=1.1464.2.178
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/bits/locale_facets.tcc.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.82.4.17&r2=1.82.4.18