- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Segmentation fault sometimes occurs in a program when icpc is used.
The version of icpc I am using is 17.0.2 20170213, and the version of g++ is 5.2.0.
It does not happen when g++ is used.
This issue was originally found in BOUT++ code. (https://github.com/boutproject/BOUT-dev)
Please have a look at the attached reproducer.
It was written based on BOUT++ code.
If g++ is used:
$ ./a.out
0
0
1
1
1
2
2
2
But if icpc is used:
$ ./a.out.intel
0
0
...
Segmentation fault (core dumped)
Please note that sometimes the segfault does not occur, but always the output is corrupted.(0 0 0....)
The problem does not happen even if icpc is used when
1) a copy constructor is defined (a.out.intel.copy)
2) reference variables are not used (a.out.intel.noref)
Though this issue had been fixed in BOUT++ code by doing 2) (https://github.com/boutproject/BOUT-dev/pull/468), but I still suspect this is a bug of intel compiler because the problem does not happen with g++.
Is this a bug of icpc?
Best regards,
Daichi
- 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
This looks like a user error. A copy constructor is needed to keep the reference data members valid.
DataIterator has several self-references, but no copy constructor to keep them consistent. And of course all the member functions of Test return an object of type DataIterator. At what do those references wind up pointing if the member functions aren’t inlined?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Judith,
Thank you very much for your answer.
g++ works in that case without user defined copy constructor, so it worked unexpectedly?
Best regards,
Daichi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
icc also "works" if you enable optimization (i.e. compiler at -O1 or higher so the code is inlined). That doesn't mean the code is correct.

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