1/* { dg-do compile } */ 2/* { dg-options "-O2 -fcompare-debug -w" } */ 3 4typedef union tree_node *tree; 5typedef unsigned int source_location; 6enum tree_code 7{ 8 MINUS_EXPR, 9 MULT_EXPR, 10}; 11struct tree_omp_clause 12{ 13 union omp_clause_subcode 14 { 15 enum tree_code reduction_code; 16 } subcode; 17}; 18union tree_node 19{ 20 struct tree_omp_clause omp_clause; 21}; 22enum tree_index 23{ 24 TI_ERROR_MARK, 25}; 26typedef struct 27{ 28 unsigned allocatable:1; 29 unsigned dimension:1; 30 unsigned codimension:1; 31 unsigned external:1; 32 unsigned optional:1; 33 unsigned pointer:1; 34 unsigned contiguous:1; 35 unsigned referenced:1; 36} symbol_attribute; 37typedef unsigned int gfc_char_t; 38typedef struct gfc_linebuf 39{ 40 source_location location; 41} gfc_linebuf; 42typedef struct 43{ 44 gfc_char_t *nextc; 45 gfc_linebuf *lb; 46} locus; 47typedef struct 48{ 49 struct gfc_symbol *sym; 50 struct gfc_namelist *next; 51} gfc_namelist; 52enum 53{ 54 OMP_LIST_PLUS, 55 OMP_LIST_REDUCTION_FIRST = OMP_LIST_PLUS, 56 OMP_LIST_MULT, 57 OMP_LIST_SUB, 58 OMP_LIST_NUM 59}; 60typedef struct gfc_omp_clauses 61{ 62 gfc_namelist *lists[OMP_LIST_NUM]; 63} gfc_omp_clauses; 64typedef struct gfc_symbol 65{ 66 symbol_attribute attr; 67} gfc_symbol; 68typedef struct gfc_code 69{ 70 locus loc; 71 union 72 { 73 gfc_omp_clauses *omp_clauses; 74 } ext; 75} gfc_code; 76typedef struct 77{ 78} stmtblock_t; 79 80static tree 81gfc_trans_omp_reduction_list (gfc_namelist * namelist, tree list, 82 enum tree_code reduction_code, locus where) 83{ 84 for (; namelist != ((void *) 0); namelist = namelist->next) 85 if (namelist->sym->attr.referenced) 86 { 87 tree node = build_omp_clause (where.lb->location); 88 node->omp_clause.subcode.reduction_code = reduction_code; 89 gfc_trans_omp_array_reduction (namelist->sym, where); 90 } 91} 92 93static tree 94gfc_trans_omp_clauses (stmtblock_t * block, gfc_omp_clauses * clauses, 95 locus where) 96{ 97 tree omp_clauses = (tree) ((void *) 0); 98 int list; 99 for (list = 0; list < OMP_LIST_NUM; list++) 100 { 101 gfc_namelist *n = clauses->lists[list]; 102 enum tree_code reduction_code; 103 if (n == ((void *) 0)) 104 continue; 105 switch (list) 106 { 107 case OMP_LIST_MULT: 108 reduction_code = MULT_EXPR; 109 break; 110 case OMP_LIST_SUB: 111 reduction_code = MINUS_EXPR; 112 } 113 gfc_trans_omp_reduction_list (n, omp_clauses, reduction_code, where); 114 } 115} 116 117void 118gfc_trans_omp_parallel_workshare (gfc_code * code) 119{ 120 stmtblock_t block; 121 gfc_trans_omp_clauses (&block, code->ext.omp_clauses, code->loc); 122} 123