aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/builtins.cc')
-rw-r--r--gcc/builtins.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/gcc/builtins.cc b/gcc/builtins.cc
index e818e81..a2ce372 100644
--- a/gcc/builtins.cc
+++ b/gcc/builtins.cc
@@ -1158,12 +1158,18 @@ validate_arglist (const_tree callexpr, ...)
unsigned int idx = TREE_INT_CST_LOW (TREE_VALUE (args)) - 1;
unsigned int idx2
= TREE_INT_CST_LOW (TREE_VALUE (TREE_CHAIN (args))) - 1;
+ unsigned int idx3 = idx2;
+ if (tree chain2 = TREE_CHAIN (TREE_CHAIN (args)))
+ idx3 = TREE_INT_CST_LOW (TREE_VALUE (chain2)) - 1;
if (idx < (unsigned) call_expr_nargs (callexpr)
&& idx2 < (unsigned) call_expr_nargs (callexpr)
+ && idx3 < (unsigned) call_expr_nargs (callexpr)
&& POINTER_TYPE_P (TREE_TYPE (CALL_EXPR_ARG (callexpr, idx)))
&& integer_zerop (CALL_EXPR_ARG (callexpr, idx))
&& INTEGRAL_TYPE_P (TREE_TYPE (CALL_EXPR_ARG (callexpr, idx2)))
- && integer_nonzerop (CALL_EXPR_ARG (callexpr, idx2)))
+ && integer_nonzerop (CALL_EXPR_ARG (callexpr, idx2))
+ && INTEGRAL_TYPE_P (TREE_TYPE (CALL_EXPR_ARG (callexpr, idx3)))
+ && integer_nonzerop (CALL_EXPR_ARG (callexpr, idx3)))
return false;
}
@@ -3529,7 +3535,8 @@ expand_builtin_strnlen (tree exp, rtx target, machine_mode target_mode)
wide_int min, max;
int_range_max r;
- get_global_range_query ()->range_of_expr (r, bound);
+ get_range_query (cfun)->range_of_expr (r, bound,
+ currently_expanding_gimple_stmt);
if (r.varying_p () || r.undefined_p ())
return NULL_RTX;
min = r.lower_bound ();
@@ -3604,7 +3611,8 @@ determine_block_size (tree len, rtx len_rtx,
{
int_range_max r;
tree tmin, tmax;
- get_global_range_query ()->range_of_expr (r, len);
+ gimple *cg = currently_expanding_gimple_stmt;
+ get_range_query (cfun)->range_of_expr (r, len, cg);
range_type = get_legacy_range (r, tmin, tmax);
if (range_type != VR_UNDEFINED)
{