Quantcast
Channel: Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1616

[BUG] internal error: icc chokes on struct with function pointer

$
0
0
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.

 


Viewing all articles
Browse latest Browse all 1616

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>