This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[tree-ssa] PATCH to generate ARRAY_REFs to INDIRECT_REFs
- From: Jason Merrill <jason at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 19 Aug 2003 22:52:04 -0400
- Subject: [tree-ssa] PATCH to generate ARRAY_REFs to INDIRECT_REFs
Several people have objected to the C/C++ frontends generating pointer
arithmetic rather than ARRAY_REFs when the array operand is an
INDIRECT_REF. The obvious fix doesn't seem to break anything.
Booted and tested athlon-pc-linux-gnu, applied to tree-ssa.
2003-08-19 Jason Merrill <jason@redhat.com>
* c-typeck.c (build_array_ref): Also build ARRAY_REFs from
INDIRECT_REFs of ARRAY_TYPE.
* cp/typeck.c (build_array_ref): Also build ARRAY_REFs from
INDIRECT_REFs of ARRAY_TYPE.
*** ./cp/typeck.c.~1~ Tue Aug 19 14:38:36 2003
--- ./cp/typeck.c Tue Aug 19 17:07:44 2003
*************** build_array_ref (tree array, tree idx)
*** 2336,2343 ****
break;
}
! if (TREE_CODE (TREE_TYPE (array)) == ARRAY_TYPE
! && TREE_CODE (array) != INDIRECT_REF)
{
tree rval, type;
--- 2336,2342 ----
break;
}
! if (TREE_CODE (TREE_TYPE (array)) == ARRAY_TYPE)
{
tree rval, type;
*** ./c-typeck.c.~1~ Tue Aug 19 14:38:35 2003
--- ./c-typeck.c Tue Aug 19 17:07:44 2003
*************** build_array_ref (tree array, tree index)
*** 1408,1415 ****
|| TREE_TYPE (index) == error_mark_node)
return error_mark_node;
! if (TREE_CODE (TREE_TYPE (array)) == ARRAY_TYPE
! && TREE_CODE (array) != INDIRECT_REF)
{
tree rval, type;
--- 1408,1414 ----
|| TREE_TYPE (index) == error_mark_node)
return error_mark_node;
! if (TREE_CODE (TREE_TYPE (array)) == ARRAY_TYPE)
{
tree rval, type;