Re: [PATCH] ctype: Fix bitfield types on 16-bit targets
Thomas Wolff <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <[email protected]> |
Am 26.07.2018 um 22:35 schrieb Brian Inglis: > On 2018-07-26 10:05, Andre Vieira (lists) wrote: >> On 20/07/18 12:57, Corinna Vinschen wrote: >>> On Jul 20 13:07, Sebastian Huber wrote: >>>> This prevents errors like this: >>>> newlib/libc/ctype/categories.c:6:3: error: width of 'first' exceeds its type >>>> unsigned int first: 24; >>>> ^ >>>> Signed-off-by: Sebastian Huber <[email protected]> >>>> --- >>>> newlib/libc/ctype/categories.c | 5 +++-- >>>> newlib/libc/ctype/towctrans_l.c | 9 +++++---- >>>> 2 files changed, 8 insertions(+), 6 deletions(-) >>> ACK. Please push. >> Our aarch64 and arm bare-metal tests are showing failures with gcc's >> libstdc++ 22_locale/ctype/to/wchar_t/1.cc after this patch. >> src/gcc/libstdc++-v3/testsuite/22_locale/ctype/to/wchar_t/1.cc:66: void >> test01(): Assertion 'c100 == c00' failed. >> I haven't looked further into, just finished bisecting the issue. >> Any idea what might be going wrong? > Besides uninformative messages, small s is not being uppercased to capital S; > https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libstdc%2B%2B-v3/testsuite/22_locale/ctype/to/wchar_t/1.cc: > > ... > typedef wchar_t char_type; > class gnu_ctype: public std::ctype<char_type> { }; > > void test01() > { > ... > const char_type c00 = L'S'; > const char_type c10 = L's'; > > gnu_ctype gctype; > char_type c100; > ... > // char_type toupper(char_type c) const > c100 = gctype.toupper(c10); > VERIFY( c100 == c00 ); > ... > > which if not overridden by a non-default locale elsewhere may end up at: > > https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libstdc%2B%2B-v3/config/os/newlib/ctype_configure_char.cc#l69 > > char > ctype<char>::do_toupper(char __c) const > { > int __x = __c; > return (this->is(ctype_base::lower, __c) ? (__x - 'a' + 'A') : __x); > } > > which depends on the lower case test working correctly, which depends on the > locale table initialization, wherever that's done. Whatever gctype.toupper may be mapped to, the following gives me the correct output: printf ("%X %X\n", toupper('s'), towupper('s'));