Created attachment 51510 [details] Testcase g++-12.0.0-alpha20210919 snapshot (g:32731fa5b0abf092029b8e2be64319b978bda514) ICEs when compiling the attached testcase, partially reduced from libstdc++-v3/testsuite/26_numerics/pstl/numeric_ops/reduce.cc, w/ -fopenmp: % g++-12.0.0 -fopenmp -c vksbmhow.cc vksbmhow.cc: In function 'void __simd_transform_reduce(_Size, _Tp, _BinaryOperation) [with _Size = int; _Tp = Number; _BinaryOperation = int]': vksbmhow.cc:25:9: error: no matching function for call to 'Number::Number()' 25 | #pragma omp simd | ^~~ vksbmhow.cc:2:3: note: candidate: 'Number::Number(int)' 2 | Number(int); | ^~~~~~ vksbmhow.cc:2:3: note: candidate expects 1 argument, 0 provided vksbmhow.cc:1:8: note: candidate: 'constexpr Number::Number(const Number&)' 1 | struct Number { | ^~~~~~ vksbmhow.cc:1:8: note: candidate expects 1 argument, 0 provided vksbmhow.cc:1:8: note: candidate: 'constexpr Number::Number(Number&&)' vksbmhow.cc:1:8: note: candidate expects 1 argument, 0 provided during GIMPLE pass: omplower vksbmhow.cc:25:9: internal compiler error: in scan_sharing_clauses, at omp-low.c:1205 25 | #pragma omp simd | ^~~ 0x7c90d0 scan_sharing_clauses /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20210919/work/gcc-12-20210919/gcc/omp-low.c:1205 0x1014514 scan_omp_for /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20210919/work/gcc-12-20210919/gcc/omp-low.c:2820 0x1015c00 scan_omp_1_stmt /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20210919/work/gcc-12-20210919/gcc/omp-low.c:4137 0xe7deea walk_gimple_stmt(gimple_stmt_iterator*, tree_node* (*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*), walk_stmt_info*) /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20210919/work/gcc-12-20210919/gcc/gimple-walk.c:602 0xe7e120 walk_gimple_seq_mod(gimple**, tree_node* (*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*), walk_stmt_info*) /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20210919/work/gcc-12-20210919/gcc/gimple-walk.c:51 0xe7dfd5 walk_gimple_stmt(gimple_stmt_iterator*, tree_node* (*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*), walk_stmt_info*) /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20210919/work/gcc-12-20210919/gcc/gimple-walk.c:711 0xe7e120 walk_gimple_seq_mod(gimple**, tree_node* (*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*), walk_stmt_info*) /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20210919/work/gcc-12-20210919/gcc/gimple-walk.c:51 0xe7dfd5 walk_gimple_stmt(gimple_stmt_iterator*, tree_node* (*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*), walk_stmt_info*) /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20210919/work/gcc-12-20210919/gcc/gimple-walk.c:711 0xe7e120 walk_gimple_seq_mod(gimple**, tree_node* (*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*), walk_stmt_info*) /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20210919/work/gcc-12-20210919/gcc/gimple-walk.c:51 0x10213e5 scan_omp /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20210919/work/gcc-12-20210919/gcc/omp-low.c:4241 0x10213e5 execute_lower_omp /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20210919/work/gcc-12-20210919/gcc/omp-low.c:14292 0x10213e5 execute /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20210919/work/gcc-12-20210919/gcc/omp-low.c:14350
It started with my r12-3654-ge5597f2ad55219092929dc12ea15e1edba06df18 then. Shorter testcase: struct S { S (int); }; void bar (S &); void foo () { #pragma omp simd for (int i = 0; i < 64; i++) { S s = 26; bar (s); } }
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>: https://gcc.gnu.org/g:4f07769057c45ec9e751ab1c23e0fe4750102840 commit r12-3917-g4f07769057c45ec9e751ab1c23e0fe4750102840 Author: Jakub Jelinek <jakub@redhat.com> Date: Tue Sep 28 11:38:03 2021 +0200 openmp: Don't call omp_finish_clause on implicitly added private clauses on simd [PR102492] The gimplifier adds implicit private clauses on SIMD constructs for local variables in the SIMD body if they are addressable to make sure they use the magic arrays with "omp simd array" attribute (such that each SIMD lane has its own copy), but we actually don't need to default privatize etc. those, the construction for them is done in the SIMD body and so is destruction. omp_finish_clause for C++ now requires default constructor (and dtor) for private, so that OpenMP 5.1 default(private) works, but that will never be needed on SIMD. So, this patch just doesn't call omp_finish_clause for private on simd. The C and Fortran langhooks don't do anything for private. 2021-09-28 Jakub Jelinek <jakub@redhat.com> PR middle-end/102492 * gimplify.c (gimplify_adjust_omp_clauses_1): Don't call the omp_finish_clause langhook on implicitly added OMP_CLAUSE_PRIVATE clauses on SIMD constructs. * g++.dg/gomp/simd-3.C: New test.
Should be fixed now.