+2018-05-30 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/85369
+ * builtins.c (expand_builtin_stpcpy_1): New function.
+ (expand_builtin_stpcpy): Call it, and call maybe_warn_nonstring_arg
+ only if the former succeeds.
+
2018-05-31 Sameera Deshpande <sameera.deshpande@linaro.org>
* config/aarch64/aarch64-cores.def (saphira) : Add support for ARMv8.4
mode MODE if that's convenient). */
static rtx
-expand_builtin_stpcpy (tree exp, rtx target, machine_mode mode)
+expand_builtin_stpcpy_1 (tree exp, rtx target, machine_mode mode)
{
tree dst, src;
location_t loc = EXPR_LOCATION (exp);
}
}
+/* Expand a call EXP to the stpcpy builtin and diagnose uses of nonstring
+ arguments while being careful to avoid duplicate warnings (which could
+ be issued if the expander were to expand the call, resulting in it
+ being emitted in expand_call(). */
+
+static rtx
+expand_builtin_stpcpy (tree exp, rtx target, machine_mode mode)
+{
+ if (rtx ret = expand_builtin_stpcpy_1 (exp, target, mode))
+ {
+ /* The call has been successfully expanded. Check for nonstring
+ arguments and issue warnings as appropriate. */
+ maybe_warn_nonstring_arg (get_callee_fndecl (exp), exp);
+ return ret;
+ }
+
+ return NULL_RTX;
+}
+
/* Check a call EXP to the stpncpy built-in for validity.
Return NULL_RTX on both success and failure. */