Re: [PATCH][Middle-end]change char type to unsigned char type when expanding strcmp/strncmp

2018-07-19 Thread Qing Zhao
> On Jul 19, 2018, at 2:24 PM, Jakub Jelinek wrote: > > On Thu, Jul 19, 2018 at 02:06:16PM -0500, Qing Zhao wrote: >>> If you expand it as (int) ((unsigned char *)p)[n] - (int) ((unsigned char >>> *)q)[n] >>> then aren't you relying on int type to have wider precision than unsigned >>> char

Re: [PATCH][Middle-end]change char type to unsigned char type when expanding strcmp/strncmp

2018-07-19 Thread Jakub Jelinek
On Thu, Jul 19, 2018 at 02:06:16PM -0500, Qing Zhao wrote: > > If you expand it as (int) ((unsigned char *)p)[n] - (int) ((unsigned char > > *)q)[n] > > then aren't you relying on int type to have wider precision than unsigned > > char > > (or unit_mode being narrower than mode)? > > do you

Re: [PATCH][Middle-end]change char type to unsigned char type when expanding strcmp/strncmp

2018-07-19 Thread Qing Zhao
Jakub, thanks a lot for you review and comments. > On Jul 19, 2018, at 12:31 PM, Jakub Jelinek wrote: > > On Thu, Jul 19, 2018 at 11:49:16AM -0500, Qing Zhao wrote: >> As Wilco mentioned in PR78809 after I checked in the last part of >> implementation of inline strcmp: >> >> See

Re: [PATCH][Middle-end]change char type to unsigned char type when expanding strcmp/strncmp

2018-07-19 Thread Jakub Jelinek
On Thu, Jul 19, 2018 at 11:49:16AM -0500, Qing Zhao wrote: > As Wilco mentioned in PR78809 after I checked in the last part of > implementation of inline strcmp: > > See http://www.iso-9899.info/n1570.html > section 7.24.4: > > "The sign of a nonzero value returned by the comparison functions

[PATCH][Middle-end]change char type to unsigned char type when expanding strcmp/strncmp

2018-07-19 Thread Qing Zhao
Hi, As Wilco mentioned in PR78809 after I checked in the last part of implementation of inline strcmp: See http://www.iso-9899.info/n1570.html section 7.24.4: "The sign of a nonzero value returned by the comparison functions memcmp, strcmp, and strncmp is determined by the sign of the