- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Forgot to post versions:
$ icc -V Intel(R) C Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 14.0.2.144 Build 20140120 Copyright (C) 1985-2014 Intel Corporation. All rights reserved. FOR NON-COMMERCIAL USE ONLY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I can also reproduce this issue, thanks for reporting. I have escalated to development team. I will inform you when I have an update.
Reddy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just to let you know, icc 16.0.0.069 Beta Build 20150527 still shows this issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just to let you know, icc 18.0.0 20170811 still shows this issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes this bug is still open in our database (as cmplrs-626).
There are two possible workarounds, as shown below under #ifdef OK or #ifdef OK2. The bug has to do with placing a temporary declaration which uses x before the declaration of x on the list of static variables. extern struct stream_s make_stream(void); struct stream_s { void *clo; /* for strctl */ int(*ctl)(void*, ...); }; struct stream_s make_stream(void) { #ifdef OK int x; #else static int x; #endif #ifdef OK2 struct stream_s tmp; tmp.clo = &x; return tmp; #else return (struct stream_s){.clo = &x}; #endif }

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page