This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 01/11] Add __builtin_speculation_safe_value
On 27/07/18 13:11, Nathan Sidwell wrote:
> On 07/27/2018 05:37 AM, Richard Earnshaw wrote:
>
> +/* Work out the size of the first argument of a call to
> + __builtin_speculation_safe_value. Only pointers and integral types
> + are permitted. Return -1 if the argument type is not supported or
> + the size is too large; 0 if the argument type is a pointer or the
> + size if it is integral. */
> +static enum built_in_function
> +speculation_safe_value_resolve_call (tree function, vec<tree, va_gc>
> *params)
>
> If I'm reading the expander correctly, isn't it 'pointers to integral
> types', not any old pointer?
>
The intention is to allow pointer to anything.
> so the following needs some adjustment...
>
> + if (POINTER_TYPE_P (type))
> + return BUILT_IN_SPECULATION_SAFE_VALUE_PTR;
> +
> + if (!INTEGRAL_TYPE_P (type))
> + goto incompatible;
>
> + if (!COMPLETE_TYPE_P (type))
> + goto incompatible;
>
> Are incomplete integral types a thing? (forward enum extension?)
>
> I presume resolve_overloaded_builtin already works correctly with
> template instantiations, but a templatatized testcase would be nice --
> shout if you'd like help constructing one.
>
Yelp!
> nathan
>
R.