forwarded from https://bugs.freedesktop.org/show_bug.cgi?id=77580 Hello, I've been testing GCC 4.9 for a virtual gentoo machine and I noticed that you us flatten attribute in source code. In case of src/sna/sna_glyphs.c flatten functions, inliner inlines about 3.3M functions and crashes because of no free memory (I have 8GB memory). Please notice that LTO has ability to optimize whole program. As a result, it sees almost all function bodies and that leads to enormous inlining. Suggested patch removes these flatten attributes for selected functions. Thank you, MArtin
It would nice if you attach a testcase which uses large amount of memory.
How I can create such testcase? I can reproduce it on Gentoo by adding -flto to /etc/portage/make.conf and running: emerge xf86-video-intel but can't reproduce from command-line gcc -std=gnu99 -O3 -shared -fPIC -flto sna_glyphs.i -o test.so
Heh, yeah. flatten with LTO will indeed have the possibility to inline very many functions ;) Note that all limits we expose on inlining (large function, large unit, etc.) are not applied here. Not sure if limiting flatten to early inlining would be a good idea (you'd never get cross-module inlining on flatten that way, similar to always_inline). Maybe we should impose a really-large-function limit ... (and flatten in function size order).
, There is another bug about this now too.
Dup of bug 77472. *** This bug has been marked as a duplicate of bug 77472 ***