Compiling this source causes an ICE on the call to (*f)(3). Preprocessed source in an attachment, non-preprocessed source below. The ICE doesn't happen if "f" is assigned to a user function poiner. The segmentation fault happens on either Linux (4.0.3 20051201 Debian prerelease) or Mac OS X (4.0.0 Apple build), and I couldn't find a bugzilla bug for it.
Source: #include <stdlib.h> void *(* const f)(size_t) = malloc; void *gg(void) { return (*f)(3); } Output of "gcc -v -save-temps -c x.c": Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.0 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-java-awt=gtk-default --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre --enable-mpfr --disable-werror --enable-checking=release i486-linux-gnu Thread model: posix gcc version 4.0.3 20051201 (prerelease) (Debian 4.0.2-5) /usr/lib/gcc/i486-linux-gnu/4.0.3/cc1 -E -quiet -v x.c -mtune=i486 -fpch-preprocess -o x.i ignoring nonexistent directory "/usr/local/include/i486-linux-gnu" ignoring nonexistent directory "/usr/include/i486-linux-gnu" #include "..." search starts here: #include <...> search starts here: /usr/local/include /usr/lib/gcc/i486-linux-gnu/4.0.3/include /usr/include End of search list. /usr/lib/gcc/i486-linux-gnu/4.0.3/cc1 -fpreprocessed x.i -quiet -dumpbase x.c -mtune=i486 -auxbase x -version -o x.s GNU C version 4.0.3 20051201 (prerelease) (Debian 4.0.2-5) (i486-linux-gnu) compiled by GNU C version 4.0.3 20051201 (prerelease) (Debian 4.0.2-5). GGC heuristics: --param ggc-min-expand=90 --param ggc-min-heapsize=113175 x.c: In function 'gg': x.c:6: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. For Debian GNU/Linux specific bug reporting instructions, see <URL:file:///usr/share/doc/gcc-4.0/README.Bugs>. -- Summary: ICE on const function pointer assigned to malloc Product: gcc Version: 4.0.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: kohler at cs dot ucla dot edu GCC build triplet: i486-linux-gnu GCC host triplet: i486-linux-gnu GCC target triplet: i486-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26092