Following code:
extern struct stream_s make_stream(void);
struct stream_s {
void *clo;
/* for strctl */
int(*ctl)(void*, ...);
};
struct stream_s
make_stream(void)
{
static int x;
return (struct stream_s){.clo = &x};
}
when compiled produces:
$ icc -std=c99 -g -O2 ./crash.c ": internal error: ** segmentation violation signal raised ** Access violation or stack overflow. Please contact Support. compilation aborted for ./crash.c (code 4)
Interestingly, when the function pointer is the first slot in the struct the code will run just fine.