Large local arrays that are initialized to constant values, gcc uses a static template and a call to memcpy. If these arrays are all or mostly zeroes, if we clear the array using memset and then initialize the non-zero values inline, it is generally better in two ways: a) it is faster b) it requires less program memory overhead to store the array of initializers
Here is an example of source code that gcc could do better on: void bar (char *); void foo (void) { char bigarray[0x1000] = { 0 }; bar (&bigarray[0]); } Which generates a 0x1000 byte constant array of zeroes. Instead, it would be nice if gcc would just memset the region to zeroes. This construct is used extensively in the FAAD2 open source AAC encoder/decoder library, resulting in a 35%+ increase in size. AFAICT, this applies to all targets, not just ARM. -- Summary: Improve initialization of sparse local arrays Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: middle-end AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jconner at apple dot com CC: gcc-bugs at gcc dot gnu dot org GCC host triplet: powerpc-apple-darwin7.9.0 GCC target triplet: arm-none-elf http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21478