Message ID | 87zje7rdho.fsf@schwinge.name |
---|---|
State | New |
Headers | show |
On Wed, Sep 10, 2014 at 12:12:03PM +0200, Thomas Schwinge wrote: > Are the following issues known? No, please file a PR. Supposedly either we should call cp_omp_mappable_type only for non-type-dependent expressions, or not at all if processing_template_decl and only do that once finish_omp_clauses is called with !processing_template_decl. > > template <typename T> > void f(T A, T B) > { > extern int *v; > T a = 2; > T b = 4; > > #pragma omp target map(to: v[a:b]) > v[a] = 0; > > #pragma omp target map(to: v[A:B]) > v[a] = 0; > } > > void g() > { > f(1, 5); > } Jakub
Hi! On Wed, 10 Sep 2014 12:23:04 +0200, Jakub Jelinek <jakub@redhat.com> wrote: > On Wed, Sep 10, 2014 at 12:12:03PM +0200, Thomas Schwinge wrote: > > Are the following issues known? > > No, please file a PR. Will do tomorrow. > Supposedly either we should call cp_omp_mappable_type > only for non-type-dependent expressions, or not at all if > processing_template_decl and only do that once finish_omp_clauses is called > with !processing_template_decl. Thanks for the suggestion. I tried experimenting with that, but with no experience in the C++ front end, I didn't get useful results -- I got past the original error, but then got ICEs in omp-low. > > template <typename T> > > void f(T A, T B) > > { > > extern int *v; > > T a = 2; > > T b = 4; > > > > #pragma omp target map(to: v[a:b]) > > v[a] = 0; > > > > #pragma omp target map(to: v[A:B]) > > v[a] = 0; > > } > > > > void g() > > { > > f(1, 5); > > } Grüße, Thomas
diff --git gcc/cp/decl2.c gcc/cp/decl2.c index 4be4847..b418156 100644 --- gcc/cp/decl2.c +++ gcc/cp/decl2.c @@ -1390,7 +1390,7 @@ bool cp_omp_mappable_type (tree type) { /* Mappable type has to be complete. */ - if (type == error_mark_node || !COMPLETE_TYPE_P (type)) + if (type == error_mark_node || !type || !COMPLETE_TYPE_P (type)) return false; /* Arrays have mappable type if the elements have mappable type. */ while (TREE_CODE (type) == ARRAY_TYPE)
Hi! Are the following issues known? template <typename T> void f(T A, T B) { extern int *v; T a = 2; T b = 4; #pragma omp target map(to: v[a:b]) v[a] = 0; #pragma omp target map(to: v[A:B]) v[a] = 0; } void g() { f(1, 5); } ../../openacc/T.C: In function 'void f(T, T)': ../../openacc/T.C:8:35: internal compiler error: Segmentation fault 0xc1833f crash_signal ../../source/gcc/toplev.c:339 0x697f0d tree_class_check ../../source/gcc/tree.h:2851 0x697f0d cp_omp_mappable_type(tree_node*) ../../source/gcc/cp/decl2.c:1393 0x764777 finish_omp_clauses(tree_node*) ../../source/gcc/cp/semantics.c:5671 0x6d3d39 cp_parser_omp_all_clauses ../../source/gcc/cp/parser.c:28680 0x6c6265 cp_parser_omp_target ../../source/gcc/cp/parser.c:30649 [...] The following patch avoids the crash but doesn't resolve the issue itself: ../../openacc/T.C: In function 'void f(T, T)': ../../openacc/T.C:8:28: error: array section does not have mappable type in 'map' clause #pragma omp target map(to: v[a:b]) ^ ../../openacc/T.C:11:28: error: array section does not have mappable type in 'map' clause #pragma omp target map(to: v[A:B]) ^ For additional fun, replace »v[a] = 0;« with just »;«, and see: ../../openacc/T.C: In function 'void f(T, T)': ../../openacc/T.C:8:28: error: array section does not have mappable type in 'map' clause #pragma omp target map(to: v[a:b]) ^ ../../openacc/T.C:11:28: error: array section does not have mappable type in 'map' clause #pragma omp target map(to: v[A:B]) ^ ../../openacc/T.C: In instantiation of 'void f(T, T) [with T = int]': ../../openacc/T.C:17:9: required from here ../../openacc/T.C:4:15: warning: unused variable 'v' [-Wunused-variable] extern int *v; ^ ../../openacc/T.C: In function 'void f(T, T) [with T = int]': ../../openacc/T.C:8:9: internal compiler error: Segmentation fault #pragma omp target map(to: v[a:b]) ^ 0xc1833f crash_signal ../../source/gcc/toplev.c:339 0xa51624 gimplify_omp_workshare ../../source/gcc/gimplify.c:7137 0xa3facb gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int) ../../source/gcc/gimplify.c:8144 0xa432c6 gimplify_stmt(tree_node**, gimple_statement_base**) ../../source/gcc/gimplify.c:5416 0xa3ec93 gimplify_statement_list ../../source/gcc/gimplify.c:1450 0xa3ec93 gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int) ../../source/gcc/gimplify.c:8090 0xa432c6 gimplify_stmt(tree_node**, gimple_statement_base**) ../../source/gcc/gimplify.c:5416 0xa44147 gimplify_bind_expr ../../source/gcc/gimplify.c:1099 [...] Program received signal SIGSEGV, Segmentation fault. gimplify_omp_workshare (expr_p=expr_p@entry=0x7ffff6845988, pre_p=pre_p@entry=0x7fffffffca68) at ../../source/gcc/gimplify.c:7137 7137 if (gimple_code (g) == GIMPLE_BIND) (gdb) print g $1 = (gimple) 0x0 (gdb) list 7132 gimplify_scan_omp_clauses (&OMP_CLAUSES (expr), pre_p, ort); 7133 if (ort == ORT_TARGET || ort == ORT_TARGET_DATA) 7134 { 7135 push_gimplify_context (); 7136 gimple g = gimplify_and_return_first (OMP_BODY (expr), &body); 7137 if (gimple_code (g) == GIMPLE_BIND) 7138 pop_gimplify_context (g); 7139 else 7140 pop_gimplify_context (NULL); 7141 if (ort == ORT_TARGET_DATA) (gdb) print expr $2 = (tree) 0x7ffff6835988 (gdb) call debug_tree(expr) <omp_target 0x7ffff6835988 type <void_type 0x7ffff66ff000 void type_6 VOID align 8 symtab 0 alias set -1 canonical type 0x7ffff66ff000 pointer_to_this <pointer_type 0x7ffff66ff0a8>> side-effects tree_1 arg 0 <statement_list 0x7ffff68467a0 type <void_type 0x7ffff66ff000 void> head (nil) tail (nil) stmts > ../../openacc/T.C:8:9> Grüße, Thomas