Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
Announcements
The Intel sign-in experience has changed to support enhanced security controls. If you sign in, click here for more information.
7783 Discussions

Segmentation fault while compiling with openmp

Arnov
Beginner
1,228 Views

My code which works fine with gcc, causes a segmentation fault with icpc. Please find the reduced down code, which replicates the same below. I am attaching the cpp file with all the details needed, OS, CPUinfo, etc, along with the preprocess file.

 


#include <memory>
#include <exception>

void action( void ) ;

void func( void )
{
const char *errstr = NULL ;
const long ndata = 128 ;
std::shared_ptr<long> bdata[ ndata ] ;

#if defined( _OPENMP )
#pragma omp parallel for \
num_threads( 4 ) \
default( none ) \
shared( bdata, errstr )
#endif /* _OPENMP */

for( long i = 1 ; i < ndata ; ++i )
{
#if defined( _OPENMP )
#pragma omp flush( errstr )
#endif /* _OPENMP */

try { action() ; }

catch( std::exception &oops ) { errstr = "error" ; }

catch( ... ) { errstr = "error" ; }
}
}

Labels (3)
0 Kudos
3 Replies
VidyalathaB_Intel
Moderator
1,205 Views

Hi Arnov,

Thanks for sharing the reproducer and also for the detailed information of your environment.

We are looking into this issue internally, we will get back to you soon.

Regards,

Vidya.



Alina_S_Intel
Employee
1,190 Views

Thank you for triaging notes and for the reproducer. This bug is escalated to the development team. It should be fixed in the upcoming compiler updates.


By the way, the issue is not reproducible with ICX when compiling ` icx -fiopenmp -c crash.cpp `. You just need to resolve and `error: variable 'ndata' must have explicitly specified data sharing attributes` . I changed 'default (none)' to 'default(shared)' and compile the code. So,ICX might be a workaround for you.


We will no longer respond to this thread. We will update the thread as soon as the fix is available.

If you require additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only.

Thanks,


Klaus-Dieter_O_Intel
705 Views

The issue was fixed in the latest compiler icpc (ICC) 2021.6.0 20220226

which is available as part of the oneAPI Base Toolkit https://www.intel.com/content/www/us/en/developer/tools/oneapi/toolkits.html or at https://www.intel.com/content/www/us/en/developer/articles/tool/oneapi-standalone-components.html#inpage-nav-6-undefined.

 

Please check and confirm the solution, thanks.


Reply