On 09/11/2023 12:24 pm, Thomas Schwinge wrote: >> --- a/gcc/tree-core.h >> +++ b/gcc/tree-core.h >> @@ -350,6 +350,9 @@ enum omp_clause_code { >> /* OpenMP clause: doacross ({source,sink}:vec). */ >> OMP_CLAUSE_DOACROSS, >> >> + /* OpenMP clause: indirect [(constant-integer-expression)]. */ >> + OMP_CLAUSE_INDIRECT, >> + >> /* Internal structure to hold OpenACC cache directive's variable-list. >> #pragma acc cache (variable-list). */ >> OMP_CLAUSE__CACHE_, > > In this position here, isn't 'OMP_CLAUSE_INDIRECT' applicable to the > 'OMP_CLAUSE_RANGE_CHECK' in 'gcc/tree.h:OMP_CLAUSE_SIZE' and > 'gcc/tree.h:OMP_CLAUSE_DECL': > > #define OMP_CLAUSE_SIZE(NODE) \ > OMP_CLAUSE_OPERAND (OMP_CLAUSE_RANGE_CHECK (OMP_CLAUSE_CHECK (NODE), \ > OMP_CLAUSE_FROM, \ > OMP_CLAUSE__CACHE_), 1) > > #define OMP_CLAUSE_DECL(NODE) \ > OMP_CLAUSE_OPERAND (OMP_CLAUSE_RANGE_CHECK (OMP_CLAUSE_CHECK (NODE), \ > OMP_CLAUSE_PRIVATE, \ > OMP_CLAUSE__SCANTEMP_), 0) > > That's probably not intentional? In that case, maybe simply move it at > the end of the clause list? (..., and generally then match that ordering > in any 'switch'es, as applicable, and likewise position > 'gcc/tree.h:OMP_CLAUSE_INDIRECT_EXPR' correspondingly.) I have moved OMP_CLAUSE_INDIRECT to just before OMP_CLAUSE__SIMDUID_ so that it is outside the range checked by OMP_CLAUSE_SIZE and OMP_CLAUSE_DECL. I have also moved its handling in c(p)_parser_omp_clause_name so that the alphabetical ordering is preserved. Committed as trivial. > I would've assumed handling for 'OMP_CLAUSE_INDIRECT' to also be > necessary in the following places: > > - 'gcc/c-family/c-omp.cc:c_omp_split_clauses' > - 'gcc/cp/pt.cc:tsubst_omp_clauses', > - 'gcc/gimplify.cc:gimplify_scan_omp_clauses', > 'gcc/gimplify.cc:gimplify_adjust_omp_clauses' > - 'gcc/omp-low.cc:scan_sharing_clauses' (twice) > - 'gcc/tree-nested.cc:convert_nonlocal_omp_clauses', > 'gcc/tree-nested.cc:convert_local_omp_clauses' > - 'gcc/tree-pretty-print.cc:dump_omp_clause' > > Please verify, and add handling as well as test cases as necessary, or, > as applicable, put 'case OMP_CLAUSE_INDIRECT:' next to > 'default: gcc_unreachable ();' etc., if indeed that clause is not > expected there. As Tobias noted, OMP_CLAUSE_INDIRECT never makes it into the middle-end. It may be generated by c(p)_parser_omp_all_clauses, and if present an attribute is applied to the function declaration, but at no point is it directly incorporated into the tree structure. I'm not sure whether it is best to explicitly list such cases as gcc_unreachable (it might imply that it can reach the ME, but just not at that particular point?) or not though. Kwok