This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C patch]: Remove some needless copying
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: "Joseph S. Myers" <jsm at polyomino dot org dot uk>
- Date: Wed, 28 Jul 2004 19:55:35 +0100
- Subject: [C patch]: Remove some needless copying
- Organization: Codesourcery LLC
Hi,
it appears that complete_array_type was doing some needless things. If
wanted I could remove the abort entirely.
booted & tested on i686-pc-linux-gnu, ok?
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk
2004-07-28 Nathan Sidwell <nathan@codesourcery.com>
* c-decl.c (complete_array_type): Don't gratuitously copy
maxindex. Check it always has a type.
Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.547
diff -c -3 -p -r1.547 c-decl.c
*** c-decl.c 26 Jul 2004 00:38:04 -0000 1.547
--- c-decl.c 28 Jul 2004 12:04:22 -0000
*************** complete_array_type (tree type, tree ini
*** 3250,3256 ****
maxindex = fold (build (PLUS_EXPR, integer_type_node,
maxindex, integer_one_node));
}
- maxindex = copy_node (maxindex);
}
else
{
--- 3251,3256 ----
*************** complete_array_type (tree type, tree ini
*** 3274,3280 ****
{
TYPE_DOMAIN (type) = build_index_type (maxindex);
if (!TREE_TYPE (maxindex))
! TREE_TYPE (maxindex) = TYPE_DOMAIN (type);
}
/* Lay out the type now that we can get the real answer. */
--- 3274,3280 ----
{
TYPE_DOMAIN (type) = build_index_type (maxindex);
if (!TREE_TYPE (maxindex))
! abort ();
}
/* Lay out the type now that we can get the real answer. */