Commit 9e322bc1 by Joseph Myers Committed by Joseph Myers

charset.c (one_utf8_to_cppchar): Correct mask used for 5-byte UTF-8 sequences.

libcpp:
	* charset.c (one_utf8_to_cppchar): Correct mask used for 5-byte
	UTF-8 sequences.

gcc/testsuite:
	* gcc.dg/cpp/utf8-5byte-1.c: New test.

From-SVN: r147073
parent aea88c05
2009-05-03 Joseph Myers <joseph@codesourcery.com>
* gcc.dg/cpp/utf8-5byte-1.c: New test.
2009-05-02 Joseph Myers <joseph@codesourcery.com> 2009-05-02 Joseph Myers <joseph@codesourcery.com>
* gcc.dg/ucnid-6.c: Fix typo in dg-do directive. * gcc.dg/ucnid-6.c: Fix typo in dg-do directive.
......
/* Test for bug in conversions from 5-byte UTF-8 sequences in
cpplib. */
/* { dg-do run { target { 4byte_wchar_t } } } */
/* { dg-options "-std=gnu99" } */
extern void abort (void);
extern void exit (int);
__WCHAR_TYPE__ ws[] = L"";
int
main (void)
{
if (ws[0] != L'\U03FFFFFF' || ws[1] != 0)
abort ();
exit (0);
}
2009-05-03 Joseph Myers <joseph@codesourcery.com>
* charset.c (one_utf8_to_cppchar): Correct mask used for 5-byte
UTF-8 sequences.
2009-04-25 Joseph Myers <joseph@codesourcery.com> 2009-04-25 Joseph Myers <joseph@codesourcery.com>
PR preprocessor/39559 PR preprocessor/39559
......
...@@ -169,7 +169,7 @@ static inline int ...@@ -169,7 +169,7 @@ static inline int
one_utf8_to_cppchar (const uchar **inbufp, size_t *inbytesleftp, one_utf8_to_cppchar (const uchar **inbufp, size_t *inbytesleftp,
cppchar_t *cp) cppchar_t *cp)
{ {
static const uchar masks[6] = { 0x7F, 0x1F, 0x0F, 0x07, 0x02, 0x01 }; static const uchar masks[6] = { 0x7F, 0x1F, 0x0F, 0x07, 0x03, 0x01 };
static const uchar patns[6] = { 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }; static const uchar patns[6] = { 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
cppchar_t c; cppchar_t c;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment