https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117684
Xi Ruoyao <xry111 at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |WONTFIX
Status|UNCONFIRMED |RESOLVED
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=113190
CC| |xry111 at gcc dot gnu.org
--- Comment #7 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
GCC 8 is EOL, so WONTFIX.
> We understand that initializing a large memory segment takes time, but
> generating the binary code for doing this task should not last long.
Also note that we cannot "generate the binary code for doing this task" in
general. For example a simple
int x[1145141919] = {1};
int main() {};
is already enough to "blow up" the compiler (so it's called a "compiler bomb")
and that's one of the reasons SECURITY.txt tells to build untrusted source
files in a sandbox. "Optimizing" this to
int x[1145141919];
void __init_x(void) __attribute__((constructor))
{
x[0] = 1;
}
int main() {}
is not always correct, see
https://gcc.gnu.org/pipermail/gcc-help/2020-July/139234.html. If you want this
"optimization" you need to do it yourself.