On Fri, Nov 19, 2021 at 09:54:12PM +0800, Chung-Lin Tang wrote: > 2021-11-19 Chung-Lin Tang <clt...@codesourcery.com> > > gcc/c/ChangeLog: > > * c-parser.c (struct omp_dim): New struct type for use inside > c_parser_omp_variable_list. > (c_parser_omp_variable_list): Allow multiple levels of array and > component accesses in array section base-pointer expression. > (c_parser_omp_clause_to): Set 'allow_deref' to true in call to > c_parser_omp_var_list_parens. > (c_parser_omp_clause_from): Likewise. > * c-typeck.c (handle_omp_array_sections_1): Extend allowed range > of base-pointer expressions involving INDIRECT/MEM/ARRAY_REF and > POINTER_PLUS_EXPR. > (c_finish_omp_clauses): Extend allowed ranged of expressions > involving INDIRECT/MEM/ARRAY_REF and POINTER_PLUS_EXPR. > > gcc/cp/ChangeLog: > > * parser.c (struct omp_dim): New struct type for use inside > cp_parser_omp_var_list_no_open. > (cp_parser_omp_var_list_no_open): Allow multiple levels of array and > component accesses in array section base-pointer expression. > (cp_parser_omp_all_clauses): Set 'allow_deref' to true in call to > cp_parser_omp_var_list for to/from clauses. > * semantics.c (handle_omp_array_sections_1): Extend allowed range > of base-pointer expressions involving INDIRECT/MEM/ARRAY_REF and > POINTER_PLUS_EXPR. > (handle_omp_array_sections): Adjust pointer map generation of > references. > (finish_omp_clauses): Extend allowed ranged of expressions > involving INDIRECT/MEM/ARRAY_REF and POINTER_PLUS_EXPR. > > gcc/fortran/ChangeLog: > > * trans-openmp.c (gfc_trans_omp_array_section): Do not generate > GOMP_MAP_ALWAYS_POINTER map for main array maps of ARRAY_TYPE type. > > gcc/ChangeLog: > > * gimplify.c (extract_base_bit_offset): Add 'tree *offsetp' parameter, > accomodate case where 'offset' return of get_inner_reference is > non-NULL. > (is_or_contains_p): Further robustify conditions. > (omp_target_reorder_clauses): In alloc/to/from sorting phase, also > move following GOMP_MAP_ALWAYS_POINTER maps along. Add new sorting > phase where we make sure pointers with an attach/detach map are ordered > correctly. > (gimplify_scan_omp_clauses): Add modifications to avoid creating > GOMP_MAP_STRUCT and associated alloc map for attach/detach maps. > > gcc/testsuite/ChangeLog: > > * c-c++-common/goacc/deep-copy-arrayofstruct.c: Adjust testcase. > * c-c++-common/gomp/target-enter-data-1.c: New testcase. > * c-c++-common/gomp/target-implicit-map-2.c: New testcase. > > libgomp/ChangeLog: > > * target.c (gomp_map_vars_existing): Make sure attached pointer is > not overwritten during cross-host/device copying. > (gomp_update): Likewise. > (gomp_exit_data): Likewise. > * testsuite/libgomp.c++/target-11.C: Adjust testcase. > * testsuite/libgomp.c++/target-12.C: Likewise. > * testsuite/libgomp.c++/target-15.C: Likewise. > * testsuite/libgomp.c++/target-16.C: Likewise. > * testsuite/libgomp.c++/target-17.C: Likewise. > * testsuite/libgomp.c++/target-21.C: Likewise. > * testsuite/libgomp.c++/target-23.C: Likewise. > * testsuite/libgomp.c/target-23.c: Likewise. > * testsuite/libgomp.c/target-29.c: Likewise. > * testsuite/libgomp.c-c++-common/target-implicit-map-2.c: New testcase.
> @@ -12982,6 +12991,7 @@ c_parser_omp_variable_list (c_parser *parser, > > while (1) > { > + auto_vec<omp_dim> dims; > bool array_section_p = false; > if (kind == OMP_CLAUSE_DEPEND || kind == OMP_CLAUSE_AFFINITY) > { Wouldn't it be better to have the dims variable outside of the loop? You do dims.truncate (0); anyway, so when it is used, it should always start with an empty vector, but if it is outside of the loop, it won't need to be freed and allocated again for every list item. > + else > + { > + for (unsigned i = 0; i < dims.length (); i++) > + t = tree_cons (dims[i].low_bound, dims[i].length, t); > + } No {}s around single statement body. > static tree > cp_parser_omp_var_list_no_open (cp_parser *parser, enum omp_clause_code kind, > tree list, bool *colon, > bool allow_deref = false) > { > + auto_vec<omp_dim> dims; > + bool array_section_p; > cp_token *token; > bool saved_colon_corrects_to_scope_p = parser->colon_corrects_to_scope_p; > if (colon) Here it is correctly outside of the loop ;) Otherwise LGTM. Jakub