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?

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.

nathan

--
Nathan Sidwell

Reply via email to