[Bug c/93278] huge almost empty array takes huge time to compile and produces huge object file
doug at cs dot dartmouth.edu
gcc-bugzilla@gcc.gnu.org
Fri Jan 17 20:09:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93278
--- Comment #6 from doug mcilroy <doug at cs dot dartmouth.edu> ---
The waste of time and space happens in the assembler, but the assembler only
does what it is told to do. There must be a way for gcc to tell it to put array
a in a partially filled ELF section.
$ cat junk.c
char a[10000000] = "x";
int main(){ return 0; }
$ bin/gcc --version
bin/gcc (GCC) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ time /bin/gcc junk.c
real 0m3.864s
user 0m2.919s
sys 0m0.326s
$ ls -l a.exe
-rwxr-xr-x 1 DOUG DOUG 10158440 Jan 17 14:43 a.exe
More information about the Gcc-bugs
mailing list