- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It appears that the following C99 program will reliably segfault the Intel C/C++ compiler on Windows:
struct s { void *wibble; void *wobble; }; static struct s my_struct; int main(void) { static int x; my_struct = (struct s){ &x }; }
I've reproduced this on multiple versions of the Intel compiler, most recently version 19 update 3. Running icl.exe produces:
Intel(R) C++ Intel(R) 64 Compiler for applications running on IA-32, Version 19.0.3.203 Build 20190206 (13:50)
To reproduce the bug, compile the above program with:
icl /Qstd=c99 main.c
The output is:
icl /Qstd=c99 main.c Intel(R) C++ Intel(R) 64 Compiler for applications running on IA-32, Version 19.0.3.203 Build 20190206 Copyright (C) 1985-2019 Intel Corporation. All rights reserved. main.c ": internal error: ** The compiler has encountered an unexpected problem. ** Segmentation violation signal raised. ** Access violation or stack overflow. Please contact Intel Support for assistance. compilation aborted for main.c (code 4)
This bug also seems to occur if the target is 64-bit, and I've also reproduced the bug in version 18 update 3. From testing the various Intel compiler versions available on https://godbolt.org/, it seems that the code compiles on version 13.0.1, but fails on 16.0.3, 17.0.0, 18.0.0, 19.0.0, and 19.0.1.
From briefly experimenting with this program, it seems that the crash only occurs if x is declared static here, and it is also important that there is a member following 'wibble', although it need not be a pointer. It does not seem to matter what the lvalue is for the struct assignment (it can be a dereferenced pointer, for example).
- Tags:
- CC++
- Development Tools
- Intel® C++ Compiler
- Intel® Parallel Studio XE
- Intel® System Studio
- Optimization
- Parallel Computing
- Vectorization
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank for report this problem. I've reported it to our Developer with internal #CMPLRIL0-31302
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you have this as a workaround?
orcsle147:/tmp$ icc -std=c99 t.c -c
orcsle147:/tmp$ cat t.c
struct s {
void *wibble;
void *wobble;
};
static struct s my_struct;
int main(void)
{
static int x;
void* tmp = &x;
my_struct = (struct s) { tmp };
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, I can trivially work around the bug, but I thought it was worth reporting since clearly the compiler shouldn't segfault on this input.
Many thanks,
Alex

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