Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
7646 Discussions

Segmentation fault while compiling with openmp

Arnov
Beginner
521 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
2 Replies
VidyalathaB_Intel
Moderator
498 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
483 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,


Reply