This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: ia32: clearing a 7116 bytes struct inserted as "C.171.8759: .zero 7116 ... memcpy()" with gcc-4.0.2
- From: James E Wilson <wilson at specifix dot com>
- To: Etienne Lorrain <etienne_lorrain at yahoo dot fr>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 25 Aug 2005 15:34:08 -0700
- Subject: Re: ia32: clearing a 7116 bytes struct inserted as "C.171.8759: .zero 7116 ... memcpy()" with gcc-4.0.2
- References: <20050824111143.77253.qmail@web26901.mail.ukl.yahoo.com>
Etienne Lorrain wrote:
> Investigated again a big increase of size going from GCC-3.4 to 4.x
> (gcc (GCC) 4.0.2 20050811 (prerelease)) on my Gujin-v1.2, quickly way
> to reproduce:
If you want this fixed, you should file a bug report into our bugzilla
database.
Here is a quicker way to reproduce the problem.
int
sub (int i)
{
int array[1000000] = { 0 };
sub2 (&array[i]);
}
We are dumping the constructor to memory, and then doing a memcpy, when
it would be much better to just do a memset.
The culprit is code in expand_expr_real_1, case CONSTRUCTOR, which
checks to see if we have a constructor of all constants, in which case
we force it to the constant pool. Not a good idea if the constructor is
a megabyte in size, and all of the elements are constant zero. I don't
have a handy gcc-3.4.3 build tree, but it is apparently a VECTOR_TYPE
check that prevents this code from triggering there.
--
Jim Wilson, GNU Tools Support, http://www.specifix.com