This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix wrong argument to build_modify_expr
- From: Jeff Law <law at redhat dot com>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 28 Apr 2016 16:00:44 -0600
- Subject: [PATCH] Fix wrong argument to build_modify_expr
- Authentication-results: sourceware.org; auth=none
As Andrew pointed out a while ago, build_modify_expr's last argument is
supposed to be a tree type. However in two cases within
fix_builtin_array_notation_fn we end passing down an tree expression.
Thankfully in the contexts were this happens, the last argument isn't
actually used, so it hasn't caused problems.
This patch fixes the two call sites. Andrew and I independently
bootstrapped and regression tested this change on x86_64.
Installed on the trunk.
Jeff
commit bd4625a0c2cb387b7e05ddddab7785b1063a8a0a
Author: law <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Thu Apr 28 22:00:19 2016 +0000
2016-04-28 Andrew MacLeod <amacleod@redhat.com>
* c-array-notation.c (fix_builtin_array_notation_fn): Fix final
argument to build_modify_expr in two cases.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@235614 138bc75d-0d04-0410-961f-82ee72b054a4
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index a641721..5161f7d 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,8 @@
+2016-04-28 Andrew MacLeod <amacleod@redhat.com>
+
+ * c-array-notation.c (fix_builtin_array_notation_fn): Fix final
+ argument to build_modify_expr in two cases.
+
2016-04-27 Bernd Schmidt <bschmidt@redhat.com>
* c-parser.c (c_parser_postfix_expression_after_primary): Call
diff --git a/gcc/c/c-array-notation.c b/gcc/c/c-array-notation.c
index 716bd11..c7cf66a 100644
--- a/gcc/c/c-array-notation.c
+++ b/gcc/c/c-array-notation.c
@@ -489,7 +489,7 @@ fix_builtin_array_notation_fn (tree an_builtin_fn, tree *new_var)
new_yes_expr = build_modify_expr
(location, array_ind_value, TREE_TYPE (array_ind_value),
NOP_EXPR,
- location, func_parm, TREE_OPERAND (array_op0, 1));
+ location, func_parm, TREE_TYPE (TREE_OPERAND (array_op0, 1)));
}
new_yes_list = alloc_stmt_list ();
append_to_statement_list (new_yes_ind, &new_yes_list);
@@ -539,7 +539,7 @@ fix_builtin_array_notation_fn (tree an_builtin_fn, tree *new_var)
new_yes_expr = build_modify_expr
(location, array_ind_value, TREE_TYPE (array_ind_value),
NOP_EXPR,
- location, func_parm, TREE_OPERAND (array_op0, 1));
+ location, func_parm, TREE_TYPE (TREE_OPERAND (array_op0, 1)));
}
new_yes_list = alloc_stmt_list ();
append_to_statement_list (new_yes_ind, &new_yes_list);