https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67096
Bug ID: 67096
Summary: libstdc++ testsuite, codecvt: many UTF-8 tests illegal
(testing bytes 5 and 6)
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: gnugcc at marino dot st
Target Milestone: ---
Using the pending locale patch set for DragonFly[1], I've been running
testsuite frequently. After an update to libc to support LC_CTYPE better, we
suffered a large test regression.
For example, 22_locale/codecvt/length/wchar_t/4.cc started failing.
I modified the test noting that as long as int_type is limited to < 0x200000,
the test passes. If it's over 0x200000, it fails. This test, and many similar
to it tests:
0x200000
0x400000
0x800000
0x1000000
0x2000000
0x4000000
0x8000000
0x10000000
0x20000000
0x40000000
The reason for the failure is the libc rejects > 4 bytes as illegal, as it
should.
According to wiki[2]:
"The original specification covered numbers up to 31 bits (the original limit
of the Universal Character Set). In November 2003, UTF-8 was restricted by RFC
3629 to end at U+10FFFF, in order to match the constraints of the UTF-16
character encoding. This removed all 5- and 6-byte sequences, and about half of
the 4-byte sequences."
The test is setting the locale to "en_US.UTF-8" which by definition is limited
to 4-byte numbers. Thus, testing any number 0x200000 or greater is illegal and
should not be done. This probably affects several tests that are making the
same mistake.
[1] https://gcc.gnu.org/ml/gcc-patches/2015-07/msg02678.html
[2] https://en.wikipedia.org/wiki/UTF-8