Program compiles correctly with GCC 4.1.2, 4.2.4, 4.3.4, 4.4.3, and 4.5.0 at -O3. In GCC 4.6.0-20100419, program compiles correctly at -O1, but ICE occurs with -O1 -finline-small-functions. ICE also occurs at -O2 and higher. GCC 4.6.0 was built from source checked out of SVN on 19 Apr 2010. Host system is RHEL 5.5 on AMD Barcelona processors.
$ cat tfail.c /* tfail.c */ typedef unsigned long int (*a)(unsigned long int *); extern __inline__ unsigned long int e(unsigned long int *d){ unsigned long int r; u(r,d); return r; } a s(a f){ return f; } int main(void){ unsigned long int b[1]; unsigned long int c; int i; for(i=0;i<1;i++){ c=(*s(e))(b); c=(*s(e))(b); } return 0; } $ /opt/gcc/4.6/bin/gcc -c tfail.c -O1 $ /opt/gcc/4.6/bin/gcc -c tfail.c -O1 -finline-small-functions tfail.c:25:1: internal compiler error: in cgraph_decide_inlining_of_small_functions, at ipa-inline.c:1009 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. $ /opt/gcc/4.6/bin/gcc --version gcc (GCC) 4.6.0 20100419 (experimental) Copyright (C) 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ /opt/gcc/4.6/bin/gcc -v Using built-in specs. COLLECT_GCC=/opt/gcc/4.6/bin/gcc COLLECT_LTO_WRAPPER=/opt/gcc/4.6/libexec/gcc/x86_64-redhat-linux/4.6.0/lto-wrapper Target: x86_64-redhat-linux Configured with: ../configure --host=x86_64-redhat-linux --build=x86_64-redhat-linux --target=x86_64-redhat-linux --enable-shared --enable-static --prefix=/opt/gcc/4.6 --disable-libmudflap --enable-__cxa_atexit --enable-check=thorough --enable-languages=c,c++,fortran --enable-multilib --with-pic --enable-stage1-checking=yes --disable-nls --enable-shared=libgfortran --with-gmp=/usr/local --with-mpfr=/usr/local --with-mpc=/usr/local --with-mpfrcx=/usr/local --with-ppl=/usr/local --with-cloog=/usr/local Thread model: posix gcc version 4.6.0 20100419 (experimental) (GCC) -- Summary: ICE in gcc 4.6.0 with -O1 -finline-small-functions Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: regression AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: djdragonboy at gmail dot com GCC build triplet: x86_64-redhat-linux GCC host triplet: x86_64-redhat-linux GCC target triplet: x86_64-redhat-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43840