https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91118
Bug ID: 91118
Summary: ubsan does not work with openmp default (none)
directive
Product: gcc
Version: 9.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: alan.avbs at rocketmail dot com
Target Milestone: ---
Program fails to compile when using -fsanitize=undefined and using
the directive default(none) in a parallel region.
For instance:
#include <iostream>
int main()
{
#pragma omp parallel default(none) shared(std::cerr)
{
std::cerr<<"hello"<<std::endl;
}
return 0;
}
Fails to compile with error:
test.cc: In function ‘int main()’:
test.cc:7:28: error: ‘_ZTISo’ not specified in enclosing ‘parallel’
7 | std::cerr<<"hello"<<std::endl;
| ^~~~
test.cc:5:9: error: enclosing ‘parallel’
5 | #pragma omp parallel default(none) shared(std::cerr)
|
The code works with previous g++ versions. However I am aware of the change in
behavior as documented
here(https://www.gnu.org/software/gcc/gcc-9/porting_to.html). Also there is a
similar bug opened some years ago (#64888).