This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: patch for PR/23522


Alexey Starovoytov <alexey.starovoytov@sun.com> writes:

> *************** fold_widened_comparison (enum tree_code 
> *** 6114,6120 ****
>       return fold (build (code, type, arg0_unw,
>   			fold_convert (shorter_type, arg1_unw)));
>   
> !   if (TREE_CODE (arg1_unw) != INTEGER_CST)
>       return NULL_TREE;
>   
>     /* If we are comparing with the integer that does not fit into the range
> --- 6112,6118 ----
>       return fold (build (code, type, arg0_unw,
>   			fold_convert (shorter_type, arg1_unw)));
>   
> !   if (arg1_unw == arg1 || TREE_CODE (arg1_unw) != INTEGER_CST)
>       return NULL_TREE;
>   
>     /* If we are comparing with the integer that does not fit into the range

What if we change the condition to
    if (TREE_CODE (arg1_unw) != INTEGER_CST
        || !int_fits_type_p (arg1_unw, shorter_type))
      return NULL_TREE;

Does that fix the problem?

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]