The following example (reduced from openssl) causes GCC 4.2 to ICE when -O2 is used it works ok with -O1. It does not ICE with GCC 4.1 as well with 3.4.6
gcc -c -O2 xxx.c xxx.c: In function 'foo': xxx.c:8: warning: function called through a non-compatible type xxx.c:8: note: if this code is reached, the program will abort xxx.c:9: internal compiler error: Segmentation fault xxx.c ============================ typedef void (*fp)(void); extern char* bar(void* a1, int a2); extern char* mar(int n); char* cptr; void foo() { cptr = mar(6); ((char *(*)(void *,int (*)(void *,unsigned char **),char **))((fp)bar))(0,0,(void*)(0)); } -- Summary: ICE: on function pointer call. Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: regression AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: raj dot khem at gmail dot com GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i586-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29841