@@ -59,6 +59,8 @@ along with GCC; see the file COPYING3. If not see
#include "builtins.h"
#include "ubsan.h"
#include "cilk.h"
+#include "tree-chkp.h"
+#include "rtl-chkp.h"
static tree do_mpc_arg1 (tree, tree, int (*)(mpc_ptr, mpc_srcptr, mpc_rnd_t));
@@ -4319,6 +4321,13 @@ std_expand_builtin_va_start (tree valist, rtx nextarg)
{
rtx va_r = expand_expr (valist, NULL_RTX, VOIDmode, EXPAND_WRITE);
convert_move (va_r, nextarg, 0);
+
+ /* We do not have any valid bounds for the pointer, so
+ just store zero bounds for it. */
+ if (chkp_function_instrumented_p (current_function_decl))
+ chkp_expand_bounds_reset_for_mem (valist,
+ make_tree (TREE_TYPE (valist),
+ nextarg));
}
/* Expand EXP, a call to __builtin_va_start. */
@@ -5824,6 +5833,8 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
}
}
+ gcc_assert (!CALL_WITH_BOUNDS_P (exp));
+
switch (fcode)
{
CASE_FLT_FN (BUILT_IN_FABS):
@@ -6841,7 +6852,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
case BUILT_IN_CHKP_GET_PTR_UBOUND:
/* We allow user CHKP builtins if Pointer Bounds
Checker is off. */
- if (!flag_check_pointer_bounds)
+ if (!chkp_function_instrumented_p (current_function_decl))
{
if (fcode == BUILT_IN_CHKP_SET_PTR_BOUNDS
|| fcode == BUILT_IN_CHKP_NARROW_PTR_BOUNDS