http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48147
--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-03-16 13:41:28 UTC --- Indeed - the linker plugin allows us to take foo() local. The problem can be reproduced w/o LTO with declaring foo static. Then you get FAIL: gcc.dg/guality/pr45882.c -O2 line 16 b == 7 FAIL: gcc.dg/guality/pr45882.c -O2 line 16 c == 11 FAIL: gcc.dg/guality/pr45882.c -O2 line 16 d == 112 FAIL: gcc.dg/guality/pr45882.c -O2 line 16 e == 142 FAIL: gcc.dg/guality/pr45882.c -O3 -fomit-frame-pointer line 16 b == 7 FAIL: gcc.dg/guality/pr45882.c -O3 -fomit-frame-pointer line 16 c == 11 FAIL: gcc.dg/guality/pr45882.c -O3 -fomit-frame-pointer line 16 d == 112 FAIL: gcc.dg/guality/pr45882.c -O3 -fomit-frame-pointer line 16 e == 142 FAIL: gcc.dg/guality/pr45882.c -O3 -g line 16 b == 7 FAIL: gcc.dg/guality/pr45882.c -O3 -g line 16 c == 11 FAIL: gcc.dg/guality/pr45882.c -O3 -g line 16 d == 112 FAIL: gcc.dg/guality/pr45882.c -O3 -g line 16 e == 142 FAIL: gcc.dg/guality/pr45882.c -Os line 16 b == 7 FAIL: gcc.dg/guality/pr45882.c -Os line 16 c == 11 FAIL: gcc.dg/guality/pr45882.c -Os line 16 d == 112 FAIL: gcc.dg/guality/pr45882.c -Os line 16 e == 142 as well. So the question is what does the testcase try to test? If you add used to the set of attributes of foo then the testcase passes with LTO as well. So LTO and -g works quite well ;)