[Bug c++/108407] New: SegFault with structured binding and OpenMP without optimization
mmoelle1 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sat Jan 14 17:52:57 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108407
Bug ID: 108407
Summary: SegFault with structured binding and OpenMP without
optimization
Product: gcc
Version: 12.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: mmoelle1 at gmail dot com
Target Milestone: ---
The following code snippet compiles well but the binary stops with a
segmentation fault when compiled with 'g++ -O0 -std=c++17'. When compiled with
optimization (-O1 or better) turned on the binary works fine.
#include <tuple>
#ifdef OPENMMP_
#include <omp.h>
#endif
auto create()
{
int a = 10;
double b = 1.0;
return std::tie(a,b);
}
int main()
{
auto [a, b] = create();
double vector[100];
#pragma omp parallel for
for (int i=0; i<a; ++i)
vector[i] = b;
}
More information about the Gcc-bugs
mailing list