The second argument for builtin s390_vec_load_bndry must be an integer
constant. The C++ front end wraps a constant inside a NON_LVALUE_EXPR
which we need to unpack first. Otherwise we bail out in
s390_adjust_builtin_arglist():
t.C: In function ‘__vector(4) unsigned int test(const unsigned int*)’:
t.C:7:42: error: constant value required for builtin ‘__vector(16) signed char __builtin_s390_vlbb(const void*, int)’ argument 2
7 | return __builtin_s390_vec_load_bndry (x, 4096);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
gcc/ChangeLog:
* config/s390/s390-c.cc (s390_adjust_builtin_arglist): Fix
builtin s390_vec_load_bndry for C++.
{
tree arg = (**arglist)[src_arg_index];
+ if (c_dialect_cxx () && TREE_CODE (arg) == NON_LVALUE_EXPR)
+ arg = TREE_OPERAND (arg, 0);
+
if (TREE_CODE (arg) != INTEGER_CST)
{
error ("constant value required for builtin %qF argument %d",
src_arg_index + 1);
return;
}
- folded_args->quick_push (build_int_cst (integer_type_node,
- code));
+
+ arg = build_int_cst (integer_type_node, code);
+ if (c_dialect_cxx ())
+ arg = build1 (NON_LVALUE_EXPR, integer_type_node, arg);
+ folded_args->quick_push (arg);
src_arg_index++;
arg_assigned_p = true;
}