> On Dec 14, 2017, at 2:05 AM, Richard Biener <rguent...@suse.de> wrote:
> 
> On Wed, 13 Dec 2017, Qing Zhao wrote:
> 
>> Hi,
>> 
>> I updated gimple-fold.c as you suggested, bootstrapped and re-tested on both 
>> x86 and aarch64. no any issue.
>> 
>> ====
>> diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
>> index 353a46e..eb6a87a 100644
>> --- a/gcc/gimple-fold.c
>> +++ b/gcc/gimple-fold.c
>> @@ -1323,6 +1323,19 @@ get_range_strlen (tree arg, tree length[2], bitmap 
>> *visited, int type,
>>               the array could have zero length.  */
>>            *minlen = ssize_int (0);
>>          }
>> +
>> +      if (VAR_P (arg) 
>> +          && TREE_CODE (TREE_TYPE (arg)) == ARRAY_TYPE)
>> +        {
>> +          val = TYPE_SIZE_UNIT (TREE_TYPE (arg));
>> +          if (!val || TREE_CODE (val) != INTEGER_CST || integer_zerop (val))
>> +            return false;
>> +          val = wide_int_to_tree (TREE_TYPE (val), 
>> +                                  wi::sub(wi::to_wide (val), 1));
>> +          /* Set the minimum size to zero since the string in
>> +             the array could have zero length.  */
>> +          *minlen = ssize_int (0);
>> +        }
>>      }
>> ====
>> 
>> I plan to commit the change very soon. 
>> let me know if you have further comment.
> 
> Looks good to me.

thanks a lot for your review.

committed the patch as revision 255654
https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=255654 
<https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=255654>

PR 79538 was filed against GCC7.0, So, I assume that this patch need to be 
backported to GCC7 branch.
I will do the backporting to GCC7 later this week if there is no objection. 

Qing
> Richard.
> 

Reply via email to