This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
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]) ^ 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) 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
Attachment:
pgpE7PIu4mzql.pgp
Description: PGP signature
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |