aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple.c
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2015-08-14 16:29:38 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2015-08-14 16:29:38 +0000
commite37dcf4530a0801513792535629542f50110b198 (patch)
treeb7f2ae503a14f93402ff942c4ad71e3c3caa817e /gcc/gimple.c
parent356c32e2f4b9d44140a8333da5381813f9aad516 (diff)
downloadgcc-e37dcf4530a0801513792535629542f50110b198.zip
gcc-e37dcf4530a0801513792535629542f50110b198.tar.gz
gcc-e37dcf4530a0801513792535629542f50110b198.tar.bz2
re PR middle-end/67133 (ICE at -Os and above on x86_64-linux-gnu in gimple_op, at gimple.h:2274)
PR middle-end/67133 * gimple.c (infer_nonnull_range_by_attribute): Check that the nonnull argument position is not outside function arguments. * gcc.dg/torture/pr67133.c: New test. From-SVN: r226896
Diffstat (limited to 'gcc/gimple.c')
-rw-r--r--gcc/gimple.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc/gimple.c b/gcc/gimple.c
index cca328a..1bfa8c7 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -2694,10 +2694,13 @@ infer_nonnull_range_by_attribute (gimple stmt, tree op)
/* Now see if op appears in the nonnull list. */
for (tree t = TREE_VALUE (attrs); t; t = TREE_CHAIN (t))
{
- int idx = TREE_INT_CST_LOW (TREE_VALUE (t)) - 1;
- tree arg = gimple_call_arg (stmt, idx);
- if (operand_equal_p (op, arg, 0))
- return true;
+ unsigned int idx = TREE_INT_CST_LOW (TREE_VALUE (t)) - 1;
+ if (idx < gimple_call_num_args (stmt))
+ {
+ tree arg = gimple_call_arg (stmt, idx);
+ if (operand_equal_p (op, arg, 0))
+ return true;
+ }
}
}
}