This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ia32: clearing a 7116 bytes struct inserted as "C.171.8759: .zero 7116 ... memcpy()" with gcc-4.0.2


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]