On Thu, 9 Jul 2015, Richard Biener wrote:
> On Thu, 9 Jul 2015, Bernhard Reutner-Fischer wrote:
>
> > gcc/ChangeLog
> >
> > 2015-07-09 Bernhard Reutner-Fischer <[email protected]>
> >
> > * builtins.c (fold_builtin_tolower, fold_builtin_toupper): New
> > static functions.
> > (fold_builtin_1): Handle BUILT_IN_TOLOWER, BUILT_IN_TOUPPER.
>
> As I read it you fold tolower (X) to (X) >= target_char_set ('A')
> && (X) <= target_char_set ('Z') ? (X) - target_char_set ('A') +
> target_char_set ('a');
>
> I don't think this can be correct for all locales which need not
> have a lower-case character for all upper-case ones nor do
> all letters having one need to be in the range of 'A' to 'Z'.
And even if the locale contains the ASCII letters, the tolower / toupper
mapping for them may not be the ASCII one (consider tolower ('I') and
toupper ('i') in a Turkish locale tr_TR.ISO-8859-9 - the results are 'ı'
and 'İ' which are single-byte characters in that locale).
--
Joseph S. Myers
[email protected]