gcc -O2 -flto 1.c 2.c hangs.
-O1 or without -flto compiles and links just fine.
1.c:
struct bar {int x;};
extern struct bar foo(void);
int main()
{
struct bar x=foo();
return 0;
}
2.c:
typedef struct{int x;} bar;
bar foo (void)
{
bar x;
return x;
}
gcc -v:
Using built-in specs.
COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/4.5.0-alpha20100318/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.5.0-alpha20100318/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-4.5.0_alpha20100318/work/gcc-4.5-20100318/configure
--prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.5.0-alpha20100318
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.0-alpha20100318/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.5.0-alpha20100318
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.5.0-alpha20100318/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.5.0-alpha20100318/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.0-alpha20100318/include/g++-v4
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec
--disable-fixed-point --with-ppl --with-cloog --enable-nls
--without-included-gettext --with-system-zlib --disable-checking
--disable-werror --enable-secureplt --enable-multilib --enable-libmudflap
--disable-libssp --enable-libgomp --enable-cld
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.5.0-alpha20100318/python
--disable-libgcj --enable-languages=c,c++ --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
--with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo
4.5.0_alpha20100318' --enable-lto
Thread model: posix
gcc version 4.5.0-alpha20100318 20100318 (experimental) (Gentoo
4.5.0_alpha20100318)
--
Summary: Compiler hang with -O2 -flto
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: lto
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: marbacz at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43455