Re: [PATCH] handle casing of i/I in Turkic languages

Christophe Lyon <[email protected]> Mon, 27 Apr 2026 09:39:22 +0200
Newsgroups gmane.comp.lib.newlib
Message-ID <CAKhMtS+j9oG_0dv5VuP+yEmMUvG4Oee0DetU0peFRM-GhFb9oA@mail.gmail.com>
On Fri, Apr 24, 2026 at 12:47 PM Corinna Vinschen <[email protected]> wrote:
>
> On Apr 23 15:44, Christophe Lyon wrote:
> > Hi!
> >
> > I'm afraid this patch breaks users of towctrans().
> > Linaro CI reported this on February 25th on arm targets, and I didn't
> > notice any feedback?
> >
> > To be more specific, it introduces regressions when running the GCC
> > libstdc++ testsuite, for instance when you reach
> > towupper, which then calls towctrans,
> > The comments at the beginning of towctrans.c (and other files) say:
> > ----------------------------------------------
> > If <[locale]> is
> > LC_GLOBAL_LOCALE or not a valid locale object, the behaviour is undefined.
> > -------------------------------------------------
> > and after this patch we call:
> > -    return towctrans_l (c, w, 0);
> > +    return towctrans_l (c, w, LC_GLOBAL_LOCALE);
> >
> > Then, towctrans_l calls __jp2uc_l (c, locale)
> > and _jp2uc_l does
> >   const char * cs = l ? __locale_charset(l) : __current_locale_charset();
> > where 'l' is the locale (so LC_GLOBAL_LOCALE == -1) in this case,
> > and __locale_charset does:
> > #ifdef __HAVE_LOCALE_INFO__
> >   return __get_ctype_locale (locale)->codeset;
> > #else
> >   return locale->ctype_codeset;
> > #endif
> >
> > so it dereferences a pointer with value -1 / 0xFFFFFFFF
> > leading to a crash.
> >
> >
> > Am I missing something, is this supposed to work?
>
> It's supposed to work.  I pushed a patch
> https://sourceware.org/cgit/newlib-cygwin/commit/?id=4ba7eff4d15a
>

I confirm the GCC test now passes, thanks!

Christophe

>
> Thanks,
> Corinna