aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2011-05-22 14:51:34 +0000
committerNick Clifton <nickc@gcc.gnu.org>2011-05-22 14:51:34 +0000
commit15f072f97b41fa6fdbc62c10a9a2c55a3295f65a (patch)
treea863917c2ee321f87c1dbc947e6d24315c1d944b
parentba7923d19f3a79d2b2116fb4a35fe7aab4050d67 (diff)
downloadgcc-15f072f97b41fa6fdbc62c10a9a2c55a3295f65a.zip
gcc-15f072f97b41fa6fdbc62c10a9a2c55a3295f65a.tar.gz
gcc-15f072f97b41fa6fdbc62c10a9a2c55a3295f65a.tar.bz2
stormy16.c (xstormy16_init_builtins): prevent initialisation of non-existant args[2] element.
* config/stormy16/stormy16.c (xstormy16_init_builtins): prevent initialisation of non-existant args[2] element. Use args[] array not arg[] array to pass arguments to build_function_type_list. From-SVN: r174029
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/stormy16/stormy16.c15
2 files changed, 15 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1ea25e4..943a538 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2011-05-22 Nick Clifton <nickc@redhat.com>
+
+ * config/stormy16/stormy16.c (xstormy16_init_builtins): prevent
+ initialisation of non-existant args[2] element. Use args[] array
+ not arg[] array to pass arguments to build_function_type_list.
+
2011-05-22 Ira Rosen <ira.rosen@linaro.org>
PR tree-optimization/49087
diff --git a/gcc/config/stormy16/stormy16.c b/gcc/config/stormy16/stormy16.c
index 1a90e16..6edc2c1 100644
--- a/gcc/config/stormy16/stormy16.c
+++ b/gcc/config/stormy16/stormy16.c
@@ -2266,7 +2266,7 @@ xstormy16_init_builtins (void)
gcc_assert (n_args <= (int) ARRAY_SIZE (args));
- for (a = n_args; a >= 0; a--)
+ for (a = n_args - 1; a >= 0; a--)
args[a] = NULL_TREE;
for (a = n_args; a >= 0; a--)
@@ -2284,9 +2284,9 @@ xstormy16_init_builtins (void)
else
args[a-1] = arg;
}
- ftype = build_function_type_list (ret_type, arg[0], arg[1], NULL_TREE);
+ ftype = build_function_type_list (ret_type, args[0], args[1], NULL_TREE);
add_builtin_function (s16builtins[i].name, ftype,
- i, BUILT_IN_MD, NULL, NULL);
+ i, BUILT_IN_MD, NULL, NULL_TREE);
}
}
@@ -2407,7 +2407,8 @@ combine_bnp (rtx insn)
{
/* LT and GE conditionals should have a sign extend before
them. */
- for (and_insn = prev_real_insn (insn); and_insn;
+ for (and_insn = prev_real_insn (insn);
+ and_insn != NULL_RTX;
and_insn = prev_real_insn (and_insn))
{
int and_code = recog_memoized (and_insn);
@@ -2436,7 +2437,8 @@ combine_bnp (rtx insn)
else
{
/* EQ and NE conditionals have an AND before them. */
- for (and_insn = prev_real_insn (insn); and_insn;
+ for (and_insn = prev_real_insn (insn);
+ and_insn != NULL_RTX;
and_insn = prev_real_insn (and_insn))
{
if (recog_memoized (and_insn) == CODE_FOR_andhi3
@@ -2481,7 +2483,8 @@ combine_bnp (rtx insn)
}
}
}
- if (!and_insn)
+
+ if (and_insn == NULL_RTX)
return;
for (load = shift ? prev_real_insn (shift) : prev_real_insn (and_insn);