https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107014
Bug ID: 107014 Summary: flatten+lto Product: gcc Version: 12.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: jirislaby at gmail dot com CC: marxin at gcc dot gnu.org Target Milestone: --- Maybe this is simply a dup of bug 77472, but I am not sure what the proper solution is supposed to be. In the kernel, when LTO is enabled, we disable flatten completely, so that the build is able to finish -- in ~ 2 minutes, w/ 4G of RAM. With flatten enabled, the build didn't finish in 10 minutes, eating 40G of RAM at that point. There is only a single user of flatten in the kernel: pcpu_build_alloc_info(). Here: https://github.com/torvalds/linux/blob/bf682942cd26ce9cd5e87f73ae099b383041e782/mm/percpu.c#L2852-L2855 And that on its own makes the link not to finish in a reasonable time, with reasonable RAM. I suppose much inlining happens in such a long function. But: shouldn't really there be any limit? I am going to link this bug in the commit message disabling flatten on LTO, so that we have a reference of why/how...