On Tue, Feb 01, 2022 at 08:53:52AM -0600, Bill Schmidt wrote:
> As discussed, I simplified this patch by just changing how the error
> message is produced:
> 
> We currently give different error messages for built-in functions that
> violate range restrictions on their arguments, depending on whether we
> record them as requiring an n-bit literal or a literal between two values.
> It's better to be consistent.  Change the error message for the n-bit
> literal to look like the other one.

> --- a/gcc/config/rs6000/rs6000-call.cc
> +++ b/gcc/config/rs6000/rs6000-call.cc
> @@ -5729,8 +5729,10 @@ rs6000_expand_builtin (tree exp, rtx target, rtx /* 
> subtarget */,
>           if (!(TREE_CODE (restr_arg) == INTEGER_CST
>                 && (TREE_INT_CST_LOW (restr_arg) & ~mask) == 0))
>             {
> -             error ("argument %d must be a %d-bit unsigned literal",
> -                    bifaddr->restr_opnd[i], bifaddr->restr_val1[i]);
> +             unsigned p = ((unsigned) 1 << bifaddr->restr_val1[i]) - 1;

Don't write
  (unsigned) 1
but instead just
  1U
please.  Does it need to be 1ULL btw?  (You need this if restr_val1[i]
can be greater than or equal to 32).  (32 itself would work, but is UB
nevertheless).

Okay with that.  Thanks!


Segher

Reply via email to