Re: PR78888 - add value range info for tolower/toupper

2017-08-03 Thread Jakub Jelinek
On Thu, Aug 03, 2017 at 02:38:35PM +, Joseph Myers wrote: > On Thu, 3 Aug 2017, Jakub Jelinek wrote: > > > In any case, you should probably investigate all the locales say in glibc or > > some other big locale repository whether tolower/toupper have the expected > > properties there. > > They

Re: PR78888 - add value range info for tolower/toupper

2017-08-03 Thread Joseph Myers
On Thu, 3 Aug 2017, Jakub Jelinek wrote: > In any case, you should probably investigate all the locales say in glibc or > some other big locale repository whether tolower/toupper have the expected > properties there. They don't. In tr_TR.UTF-8, toupper ('i') == 'i', because 'İ', the correct upp

Re: PR78888 - add value range info for tolower/toupper

2017-08-03 Thread Jakub Jelinek
On Thu, Aug 03, 2017 at 04:13:38PM +0530, Prathamesh Kulkarni wrote: > > You are hardcoding here host characters and using it for target. > > I think you need to use > > lang_hooks.to_target_charset > > (really no idea how it works or doesn't in LTO, but gimple-fold.c is already > > using it among

Re: PR78888 - add value range info for tolower/toupper

2017-08-03 Thread Prathamesh Kulkarni
On 3 August 2017 at 13:21, Jakub Jelinek wrote: > On Thu, Aug 03, 2017 at 12:58:06PM +0530, Prathamesh Kulkarni wrote: >> --- a/gcc/tree-vrp.c >> +++ b/gcc/tree-vrp.c >> @@ -3778,6 +3778,19 @@ extract_range_basic (value_range *vr, gimple *stmt) >> return; >> } >>

Re: PR78888 - add value range info for tolower/toupper

2017-08-03 Thread Jakub Jelinek
On Thu, Aug 03, 2017 at 12:58:06PM +0530, Prathamesh Kulkarni wrote: > --- a/gcc/tree-vrp.c > +++ b/gcc/tree-vrp.c > @@ -3778,6 +3778,19 @@ extract_range_basic (value_range *vr, gimple *stmt) > return; > } > break; > + case CFN_BUILT_IN_TOUPPER: > + case CF

PR78888 - add value range info for tolower/toupper

2017-08-03 Thread Prathamesh Kulkarni
Hi, The attached patch adds value-range info for __builtin_tolower and __builtin_toupper. In the patch, I have just settled for anti-range ~['a', 'z'] for return value of toupper. Would that be correct albeit imprecise ? A more precise range would be: [0, UCHAR_MAX] intersect ~['a', 'z'] union EOF