On Fri, Nov 06, 2026 at 07:03:30PM +0100, Jakub Jelinek wrote:
> On Fri, Nov 06, 2026 at 12:29:23PM -0500, Marek Polacek wrote:
> > Looks like vec_safe_length (cexpr_list) is computed 3x, so
> >
> > const unsigned int len = vec_safe_length (cexpr_list);
> >
> > ?
>
> Used nargs identifier instead.
Sure.
> > > @@ -13626,7 +13641,70 @@ c_parser_postfix_expression (c_parser *p
> > > break;
> > > }
> > > arg = c_fully_fold (arg, false, NULL);
> > > - expr.value = fold_build_builtin_bswapg_bitreverseg (loc, ifn, arg);
> > > + if (ifn == IFN_CLMUL)
> > > + {
> > > + arg_p = &(*cexpr_list)[1];
> > > + *arg_p = convert_lvalue_to_rvalue (loc, *arg_p, true, true);
> > > + tree arg2 = arg_p->value;
> > > + if (error_operand_p (arg2))
> > > + {
> > > + expr.set_error ();
> > > + break;
> > > + }
> > > + if (!comptypes_same_p (type,
> > > + TYPE_MAIN_VARIANT (TREE_TYPE (arg2))))
> > > + {
> > > + error_at (loc, "arguments 1 and 2 to function %qs "
> >
> > I guess using loc here is fine but the existing <case RID_BUILTIN_TGMATH>
> > uses (*cexpr_list)[j].get_location () which maybe you can use here too
> > if you want (but with arg_p). This is not a requirement.
>
> I've switched to arg_p->get_location () for the cases where the diagnostics
> talks about a single argument. When it talks about multiple, I think
> loc is better (or one would need to use the fancy multi-location stuff.
>
> > Here we are talking about only one argument so "argument 3 [...] has [...]"?
> >
> > build_x_clmulg has this too.
>
> Fixed.
>
> > > + "have pointer to %<const%> type %qT",
> > > + name, TREE_TYPE (arg3));
> > > + expr.set_error ();
> > > + break;
> > > + }
> >
> > Note that <case BUILT_IN_MUL_OVERFLOW> also checks
> >
> > else if (TYPE_ATOMIC (TREE_TYPE (TREE_TYPE (args[2]))))
> > {
> > if (complain)
> > error_at (ARG_LOCATION (2),
> > "argument %u in call to function %qE "
> > "has pointer to %qs type (%qT)",
> > 3, fndecl, "_Atomic", TREE_TYPE (args[2]));
> > return false;
> > }
> >
> > and it seems reasonable to me to check it here too.
>
> Yeah, added.
>
> Here is an updated patch, passed make check on these tests C/C++,
> ok for trunk if it passes full bootstrap/regtest?
Thanks, the C and c-family parts are OK too.
Marek