@@ -1188,6 +1188,7 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
j--;
}
}
+ argpos = 0;
FOR_EACH_CALL_EXPR_ARG (arg, iter, exp)
{
tree argtype = TREE_TYPE (arg);
@@ -1206,6 +1207,14 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
chkp_find_bound_slots (argtype, slots);
}
}
+ else if (CALL_WITH_BOUNDS_P (exp)
+ && pass_by_reference (NULL, TYPE_MODE (argtype), argtype,
+ argpos < n_named_args))
+ {
+ if (slots)
+ BITMAP_FREE (slots);
+ ptr_arg = j;
+ }
else if (POINTER_BOUNDS_TYPE_P (argtype))
{
/* We expect bounds in instrumented calls only.
@@ -1249,6 +1258,7 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
else
args[j].tree_value = arg;
j--;
+ argpos++;
}
if (slots)
new file mode 100644
@@ -0,0 +1,13 @@
+/* { dg-do compile { target { ! x32 } } } */
+/* { dg-options "-fcheck-pointer-bounds -mmpx -Wno-implicit-function-declaration" } */
+
+void f (char *s1, char *s2)
+{
+ int z = 5;
+
+ struct { char a[z]; } x;
+
+ s1[0] = s2[0];
+
+ foo (x, x);
+}
@@ -3646,6 +3646,7 @@ chkp_find_bounds_1 (tree ptr, tree ptr_src, gimple_stmt_iterator *iter)
break;
case ADDR_EXPR:
+ case WITH_SIZE_EXPR:
bounds = chkp_make_addressed_object_bounds (TREE_OPERAND (ptr_src, 0), iter);
break;